OK, I'm sure I'm being blind again and missing something obvious, but i can't figure out what.
I am running a query against my DB and it is returning 0 results, even though when I run the query directly against the database using my DB admin panel it returns exactly what I expect it to.
Here is my code:
<?php
include_once('../inc_dbconnect.inc');
$GetCategories = "SELECT ID, Category FROM Work_Categories WHERE Active = '1'";
$GetCatResult = mysqli_query($db_server, $GetCategories)
or die("Unable to run query: " . mysqli_error($db_server));
$NumResults = mysqli_num_rows($GetCatResult);
echo $NumResults;
while($Category = mysqli_fetch_array($GetCatResult))
{
if ($Category['ID'] == $EmpDetails['workcatid'])
{
echo "<option value='" . $Category['ID'] . "' selected=\"selected\">" . $Category['Category'] . "</option>" . "\n";
} else {
echo "<option value='" . $Category['ID'] . "'>" . $Category['Category'] . "</option>" . "\n";
}
}
?>
The $NumResults and subsequent echo statement I just put in trying to see what I am returning and it shows me 0. There should be about 10 records returned that I want to use to populate a dropdown field on my website.
Hopefully someone can give me that gently nudge (or a hard smack) to get me back on the right track.
Greg







Bookmarks