SELECT WHERE query problem
Got a relatively simple MySQL query that I am using php with the following code:
$employeeNames = mysql_query(
"SELECT *
FROM employees
WHERE team=\"1st Level Technical Support_a\"
LIMIT 0,5000") or die(mysql_error());
$employeeNumRows = mysql_num_rows($employeeNames);
echo $employeeNumRows;
while ($row = mysql_fetch_array($employeeNames, $employeeNumRows)) {
echo $row['full_name'];
}
Now if I run the query on the first line in SQL it gave me 18 results. If I repeat $ employeeNumRows it outputs 18. Nothing else after that.
If I change "Technical Support_a Level 1" to any other command in the table, it outputs the correct results using PHP
This is the strangest issue I have encountered using MySQL / PHP - can anyone help? Has anyone seen something like this before?
a source to share
Try removing the second parameter from your call before mysql_fetch_array
so that it reads mysql_feetch_array($employeeNames)
. See the documentation for this function to see how to use it correctly.
a source to share