SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Zealot
    Join Date
    Aug 2002
    0 Post(s)
    0 Thread(s)

    mysql_fetch_array VS. fetch_row VS. fetch_assoc

    Hey folks.

    I've always been under the impression that using mysql_fetch_array() was a no-no because there was a serious performance reduction as many articles on the web suggest. (e.g.

    But I can't help noticing that the manual states...

    "An important thing to note is that using mysql_fetch_array() is not significantly slower than using mysql_fetch_row(), while it provides a significant added value."

    So what I am now wondering is what is the ultimate way to fetch a row of data?

    Obvioulsy mysql_fetch_row() is no good to us if we want the field names in our returned row.

    So, is the performance hit so signicantly small with mysql_fetch_array() that it is not worth worrying about, as the manual seems to suggest, or should we be using mysql_fetch_assoc(), or should we be using mysql_fetch_array($record_set, MYSQL_ASSOC)?


  2. #2
    "Of" != "Have" bronze trophy Jeff Lange's Avatar
    Join Date
    Jan 2003
    Calgary, Canada
    0 Post(s)
    0 Thread(s)
    Generally speaking, I don't see a reason for using mysql_fetch_array() if you never use the numerical index.

    However, for speed differences, it will be extremely minimal.

    (as for mysql_fetch_array($record_set, MYSQL_ASSOC), it is the exact same, only it will work with versions of PHP below 4.0.4 I believe.)
    Who walks the stairs without a care
    It shoots so high in the sky.
    Bounce up and down just like a clown.
    Everyone knows its Slinky.


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts