I have a really weird problem in a script I'm writing and I can't think of what could possibly cause it. Here is the code I'm using:
$sql = "SELECT ID FROM ". $table. "_choices"; $query = mysql_query($sql) or die("A MySQL error occurred: ". mysql_error()); echo "mysql_num_rows - ". mysql_num_rows($query). "<br />"; echo "count mysql_fetch_array - ". count(mysql_fetch_array($query));
I put the two echo's in to determine my problem. The problem is that the output text is:
mysql_num_rows - 5
count mysql_fetch_array - 2
There SHOULD be 5 rows, but why would mysql_fetch_array() only return 2 even when mysql_num_rows told me there's 5. I'm 100% positive there are 5 rows in there, and I can't understand why mysql_fetch_array() wouldn't return them all :S.
If anyone could help it would be MUCH appreciated!