Link to home
Start Free TrialLog in
Avatar of Albee_J
Albee_J

asked on

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    


SOLUTION
Avatar of Brad Brett
Brad Brett
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Albee_J
Albee_J

ASKER

Thanks Medo, I will check the link out tomorrow at work
Avatar of Albee_J

ASKER

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);
}
?>

ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Albee_J

ASKER

Getting these errors: see screenshot




error.JPG
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

Avatar of Albee_J

ASKER

Got it thanks!  I had to slightly modify
$techcellID = $_GET['techcells'];
You are welcome! :)
Avatar of Albee_J

ASKER

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
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Albee_J

ASKER

great thanks!