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?

0


a source to share


1 answer


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.



+3


a source







All Articles