I’m extending a web app that we use to manage tooling check-ins and check-outs. I’ve written some PHP that is designed to pull selected contents from a mysql table named “checkedout”, and display the contents onto a generated html page in table form. I know my SQL query is correct, if I run it straight against the db it returns the correct results, however, all I’m getting is an empty table when executing the page. Not sure where I’m going wrong here. I should also mention that I have very similar code running on other pages and it pulls the data and formats it nicely. Any help would be greatly appreciated!
Thanks
[php]<?php
//connect to server
define(‘DB_NAME’, ‘equipment’);
define(‘DB_USER’, ‘root’);
define(‘DB_PASSWORD’, ‘’);
define(‘DB_HOST’, ‘localhost’);
$link = mysql_connect(DB_HOST, DB_USER, DB_PASSWORD);
if (!$link) {
die('Could not connect: ’ . mysql_error());
}
//connect to database
$db_selected = mysql_select_db(DB_NAME, $link);
if (!$db_selected) {
die('Can’t use ’ . DB_NAME . ': ’ . mysql_error());
}
//query the database
$get_checkout_history = mysql_query(“select a.StudentID,b.FirstName,a.DateOut,a.DateIn,a.Accessories,a.Notes from checkedout a join students b on a.StudentID = b.StudentID order by a.DateOut DESC”);
//fetch the results / convert results into an array / print out to html table
$limit = 6;
$count = 0;
echo “
ID | Name | Checked Out | Checked In | Needs Repair? | Notes | ”;
---|
mysql_close();
?>[/php]