Today's Question:  What are bad parts of Windows 10?       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      5,535    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.

 Tags : PHP,MySQL,resultset,comparison,mysql_fet   Read(5,535) Comment(0) Version(0)

  SAVE AS PDF   MARK AS READ   MARK AS IMPORTANT

 RELATED


 COMMENT  (TOTAL 0 COMMENT)


No comment for this article.


Nickname  
Email 
Comment

How a hacker works

By sonic0002

 CONTRIBUTE


Share your geeky stuff now.
You make the world better, the world makes us better.

 WRITE ARTICLE

 VERSION


No other version available yet.