Results 1 to 3 of 3

Thread: fetch_object, fetch_array?

  1. #1
    denniswrenn
    Guest

    Question fetch_object, fetch_array?

    This is a PHP question..

    I know how to use both mysql_fetch_object() and mysql_fetch_array().

    PHP Code:
    //query goes here, put the result into $res
    while($row mysql_fetch_object($res))
    {
    echo 
    $row->fieldname;
    }


    //query goes here, put the result into $res
    while($row mysql_fetch_array($res))
    {
    echo 
    $row["fieldname"];


    Both of those would produce exactly the same output, but I am wondering which one is more efficient. I would assume fetch_array is quicker since it doesn't have have any OO overhead, but I'm not sure how much quicker, if it's only a small difference, I may be able to justify using it for the readability.


    Thanks,
    -Dennis

  2. #2
    scoutt
    Guest
    I don't know the difference as I have always used fetch_array

  3. #3
    denniswrenn
    Guest
    That sure was helpful

    I've always used fetch_array too, but fetch_object seems to be cleaner looking.

Posting Permissions

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



Click Here to Expand Forum to Full Width