Unanswered: returning 0 rows, but phpMyAdmin SQL returns plenty!
$query = "SELECT * FROM employees WHERE 1";
// Handle keeps coming back NON-NULL
$handle = mysql_query($query);
// These both report nothing.
$errno = mysql_errno();
$error = mysql_error();
// Reports 0.
$nNumRows = @mysql_numrows($handle);
// $row keeps coming back NULL.
$row = mysql_fetch_array($handle, MYSQL_ASSOC);
Here's the strange part -- if I paste the SQL code into phpMyAdmin, I get 2 rows, no problem.
How can this be explained?
NOTE: My database query isn't literally that simple. It has 1 join statement. But that shouldn't matter, since phpMyAdmin likes my query just fine, right?
It can't be a problem with my SQL code, because when I paste it into a text file, remove the PHP code (variables, quotes, semicolons, etc.) and paste it into phpMyAdmin, it runs and returns 2 rows. I don't change any of the SQL code; I just fill in the variables with a sample keyword.