mysql_fetch_assoc returning int

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
401kill
Forum Newbie
Posts: 2
Joined: Thu Mar 25, 2010 11:38 am

mysql_fetch_assoc returning int

Post 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
User avatar
Christopher
Site Administrator
Posts: 13596
Joined: Wed Aug 25, 2004 7:54 pm
Location: New York, NY, US

Re: mysql_fetch_assoc returning int

Post by Christopher »

Have you check the error message?
(#10850)
401kill
Forum Newbie
Posts: 2
Joined: Thu Mar 25, 2010 11:38 am

Re: mysql_fetch_assoc returning int

Post 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..?
Post Reply