Jump to content

mysql_fetch_array VS. mysql_fetch_assoc ...


cwncool

Recommended Posts

I did look both of them up in the php manual before posting here.  The only thing I noticed different, was fetch_array, can fetch any type of array, while fetch_assoc only fetches associative arrays.  I don't know what the different type of arrays mean though. 

 

I guess a better question to ask would have been:

 

What's the difference between a MYSQL_ASSOC and a MYSQL_NUM array?

mysql_fetch_array fetches both an associative and a numeric array unless you specify otherwise, thus making it a little less efficient then mysql_fetch_assoc if you want to use associative arrays.

 

Associative array allow you to index by name, not number. It makes you code allot more readable.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.