tags:

views:

81

answers:

1

Hi guys,

Got a relatively simple MySQL query that I'm pulling 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 gives me 18 results. If I echo $employeeNumRows it prints 18. Nothing else after that though.

If I change "1st Level Technical Support_a" to any other team in the table, it will bring up the proper results using PHP

This is the weirdest problem I've come across using MySQL/PHP - can anyone help? Has anyone seen something like this before?

+3  A: 

Try removing the second parameter from your call to mysql_fetch_array, so that it reads mysql_feetch_array($employeeNames). See the documentation of the function to see how to use it properly.

Daan
Amazing, I have a function using a different query but using mysql_fetch_array the same way that works fine. Thank you!
Ciaran