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:52:18 EDT