Jump to content

[SOLVED] Difference between mysql_fetch_assoc() and mysql_fetch_array()


Recommended Posts

I've been playing with these two functions and can't seem to notice much difference between them and was wondering if someone would be kind enough to explain them to me please?

 

If I replace one for the other I get exactly the same data returned and I'm wondering if there is really any significant difference?

 

Which is best to use?

 

EDIT: I have been to the mysql online manuals and can't seem to understand much there :(

mysql_fetch_array returns both a numeric and an associative array while mysql_fetch_assoc returns only an associative.

 

If your using associative indexes (more readble) then using mysql_fetch_assoc is slightly more efficient.

 

I have been to the mysql online manuals and can't seem to understand much there

 

These are both php functions (part of the mysql extension), not mysql.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.