Here's something you can try:
According to http://www.php.net/manual/en/function.mysql-fetch-assoc.php
mysql_fetch_assoc() is supposedly equivalent to mysql_fetch_array(,MYSQL_ASSOC)
but maybe it will work correctly. FWIW, I use mysql_fetch_object() almost exclusively.
SpamFree wrote:
> The following code snippet works fine. The WHILE statement returns true:
>
>
>>$catsquery = "SELECT cats, COUNT(cats) FROM data_tbl GROUP BY cats";
>>$getcats = mysql_query($catsquery) or die ("Boom!!");
>>
>>while ($catsarray = mysql_fetch_array($getcats))
>>{
>> //do stuff
>>}
>>
>
> //snip
>
> But, if I use the MYSQL_ASSOC option it fails. The WHILE statement returns
> false:
>
>
>>$catsquery = "SELECT cats, COUNT(cats) FROM data_tbl GROUP BY cats";
>>$getcats = mysql_query($catsquery) or die ("Boom!!");
>>
>>while ($catsarray = mysql_fetch_array($getcats, MYSQL_ASSOC))
>>{
>> //do stuff
>>}
>>
>
> //snip
>
> Can anyone tell me why this second snippet fails? The query can return a lot
> of records so, I want to create the array by association rather than both
> association and numeric index, as the first snippet does. You know, memory
> and all that.
>
> Any help is greatly appreciated.
This archive was generated by hypermail 2.1.3 : Fri Aug 01 2014 - 17:53:07 EDT