PHP using count() with array

Posted by seb on Stack Overflow See other posts from Stack Overflow or by seb
Published on 2010-05-26T18:09:41Z Indexed on 2010/05/26 18:11 UTC
Read the original article Hit count: 157

Filed under:

Hi there,

Im trying to get the amount of elements in an array using the count() function, the result is a bit puzzling to me, considere the following example.

Assume that the user ID provided is wrong, and therefore had no matches, wouldnt then the result of the count function be 0? yet it is 1. can you explain to me why?

thanks

$q = mysql_query("select password from users where user_name = '" .  $userID   .   "'");
$check = mysql_fetch_array($q);

$result = count($check);

echo "RESULT:" . $result;

© Stack Overflow or respective owner

Related posts about php