Today's Question:  What's your opinion about Alibaba mooncake incident?        GIVE A SHOUT

Technical Article => Web =>  PHP

mysql_fetch_array(),mysql_fetch_assoc() and mysql_fetch_row()

  Pi Ke      2011-08-05 04:53:09      6,652    0    0

In PHP MySQL mannual. There are three functions which need to be clarified for some users who may get confused when choosing which one to use to get the result.

mysql_fetch_array() : by seeting the different parameters, there are three ways to return the result set. MYSQL_ASSOC(Result set with field names as the associative indexs.It means you can use the field name as the index to get value of the specified cell). MYSQL_NUM(Result set with field names as the number indices). Or MYSQL_BOTH(you can use both modes to get value of a specified cell).

mysql_fetch_assoc():Result set with field names as the associative indexs.It means you can use the field name as the index to get value of the specified cell. It similars to mysql_fetch_array() with MYSQL_ASSOC speficied.

mysql_fetch_row():Result set with field names as the number indices.It similars to mysql_fetch_array() with MYSQL_NUM speficied.

Among these 3 functions, usually mysql_fetch_row() is the fastest one.

Note : mysql_fetch_object() has similar functions to the three functions mentioned above with the return value object instead of array.

PHP COMPARISON MYSQL RESULTSET MYSQL_FET

  SAVE AS PDF   MARK AS READ   MARK AS IMPORTANT

Share on Facebook  Share on Twitter  Share on Google+  Share on Weibo  Share on Reddit  Share on Digg  Share on Tumblr    Delicious

  RELATED


  0 COMMENT


No comment for this article.


  WRITE ARTICLE

Apple Pencil? No. IKEA Pencil!

By sonic0002
While the whole world raves about the recent Apple products and of course the advancements in the digital world, IKEA Singapore shows how traditional pen and paper still hold on to an old world charm. On its Facebook page, IKEA Singapore put up this post: Obviously this is a post laughes at the Appl