Page 1 of 1

mysql_fetch_assoc returning int

Posted: Thu Mar 25, 2010 11:44 am
by 401kill
Hi

I've encountered an interesting problem in my PHP/MySQL application - the mysql_fetch_assoc function is returning an int value of 1 when running a query against one specific table - AFAIK, it should only return an associated array, or FALSE...

Code: Select all

 
    $sql = "SELECT * FROM `changes` WHERE `id` =" . $changeId; 
    $result = mysql_query($sql);
    $change = @mysql_fetch_assoc($result);
    mysql_free_result($result);
 
returns '1'. EXACTLY the same query against my other table returns a correct array.

Any ideas?!

Cheers,
Ben

Re: mysql_fetch_assoc returning int

Posted: Thu Mar 25, 2010 4:37 pm
by Christopher
Have you check the error message?

Re: mysql_fetch_assoc returning int

Posted: Fri Mar 26, 2010 4:03 am
by 401kill
The function succeeds - or at least, does not return false or die with an error. Therefore the mysql_errno() is 0. I'm wondering if this is a bug with PHP/MySQL, or if `changes` is some sort of system reserved keyword..?