Page 1 of 1

Am I using mysql_fetch_assoc and mysql_fetch_array the corre

Posted: Tue Jun 15, 2010 7:24 am
by jazz090
When I usually call something from a database, I am either dealing with one record exclusivity or a whole bunch of record. I always use mysql_fetch_assoc when dealing with single record returns e.g. username-password authentication but if i want to display who is online for example, I just run a while ($user = mysql_fetch_array($rb_response)). Is this the correct approach?

Re: Am I using mysql_fetch_assoc and mysql_fetch_array the c

Posted: Tue Jun 15, 2010 8:59 am
by AbraCadaver
It doesn't matter, it depends on how you want to fetch the array. fetch_assoc fetches only an associative array and fetch_array can fetch either a numerical or associative or by default both. I tend to always use mysql_fetch_assoc() or the mysqli functions.