PHP query into multiple column table

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    


Albee_JAsked:
Who is Participating?
 
Mohamed AbowardaConnect With a Mentor Software EngineerCommented:
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
 
Albee_JAuthor Commented:
Thanks Medo, I will check the link out tomorrow at work
0
Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
Albee_JAuthor Commented:
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
 
Albee_JAuthor Commented:
Getting these errors: see screenshot




error.JPG
0
 
Mohamed AbowardaSoftware EngineerCommented:
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
 
Albee_JAuthor Commented:
Got it thanks!  I had to slightly modify
$techcellID = $_GET['techcells'];
0
 
Mohamed AbowardaSoftware EngineerCommented:
You are welcome! :)
0
 
Albee_JAuthor Commented:
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
 
Mohamed AbowardaConnect With a Mentor Software EngineerCommented:
0
 
Albee_JAuthor Commented:
great thanks!
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.