Monday, November 10, 2008

Question: What is the difference between mysql_fetch_object and mysql_fetch_array?

Question: What is the difference between mysql_fetch_object and mysql_fetch_array?
Answer:
MySQL fetch object will collect first single matching record where mysql_fetch_array will collect all matching records from the table in an array. mysql_fetch_object() is similar to mysql_fetch_array()‚ with one difference - an object is returned‚ instead of an array.
Indirectly‚ that means that you can only access the data by the field names‚ and not by their offsets.
MySQL_fetch_array() - Fetches a result row as an associative array‚numeric array.
MySQL_fetch_object() - Fetches a result row as an object.
MySQL_fetch_row() - Fetches a result set as a numeric array().

No comments:

security header validate

  HTTP Security Headers Check Tool - Security Headers Response (serpworx.com)