[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

PHP query into multiple column table

Posted on 2011-04-20
11
Medium Priority
?
349 Views
Last Modified: 2012-05-11
I have a db table that stores statistics for page view on our techcells.  

"select statDate, views from techcellStats WHERE techcellID = '$techcellID' ";

I need to spit that data out into an html table that shows horizontally

column headings:  Jan.      Feb.       Mar.        April    
                              Views  views  views    views    


0
Comment
Question by:Albee_J
  • 6
  • 5
11 Comments
 
LVL 12

Assisted Solution

by:Mohamed Abowarda
Mohamed Abowarda earned 2000 total points
ID: 35437584
0
 

Author Comment

by:Albee_J
ID: 35437971
Thanks Medo, I will check the link out tomorrow at work
0
 

Author Comment

by:Albee_J
ID: 35440979
Table is displaying but I cannot get techcellID to pass into the query correctly...  I am using a drop down list to select what to view

function display_db_table($tablename, $connection,
$header_bool, $table_params)
{
$query_string = "SELECT * FROM techcellView WHERE techcellID = '$techcellID' ";
display_db_query($query_string, $connection,
$header_bool, $table_params);
}
?>

0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
LVL 12

Accepted Solution

by:
Mohamed Abowarda earned 2000 total points
ID: 35441417
techcellID should be integer datatype, therefore you should remove the quatas in the line:
$query_string = "SELECT * FROM techcellView WHERE techcellID = '$techcellID' ";

Open in new window


Change it to $query_string = "SELECT * FROM techcellView WHERE techcellID = $techcellID";

Open in new window

0
 

Author Comment

by:Albee_J
ID: 35441721
Getting these errors: see screenshot




error.JPG
0
 
LVL 12

Expert Comment

by:Mohamed Abowarda
ID: 35441775
According to the function you posted, you didn't assigned a value to $techcellID, therefore it's undefined.

You need to assign a value to $techcellID, so SQL will query about it, here is example:
function display_db_table($tablename, $connection, $header_bool, $table_params)
{
$techcellID = 1; // Now $techcellID is defined
$query_string = "SELECT * FROM techcellView WHERE techcellID = $techcellID";
display_db_query($query_string, $connection,
$header_bool, $table_params);
}

Open in new window

0
 

Author Comment

by:Albee_J
ID: 35441801
Got it thanks!  I had to slightly modify
$techcellID = $_GET['techcells'];
0
 
LVL 12

Expert Comment

by:Mohamed Abowarda
ID: 35441845
You are welcome! :)
0
 

Author Comment

by:Albee_J
ID: 35441884
Do you have any idea how I could make the Stat Dats display horizontally with the views underneath?

This is how it looks now.


techcells.jpg
0
 
LVL 12

Assisted Solution

by:Mohamed Abowarda
Mohamed Abowarda earned 2000 total points
ID: 35441939
0
 

Author Comment

by:Albee_J
ID: 35441981
great thanks!
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I imagine that there are some, like me, who require a way of getting currency exchange rates for implementation in web project from time to time, so I thought I would share a solution that I have developed for this purpose. It turns out that Yaho…
Things That Drive Us Nuts Have you noticed the use of the reCaptcha feature at EE and other web sites?  It wants you to read and retype something that looks like this. Insanity!  It's not EE's fault - that's just the way reCaptcha works.  But it i…
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …
Suggested Courses

830 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question