0

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?

0

1 Answer 1

3

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.

Sign up to request clarification or add additional context in comments.

1 Comment

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.