Basic PHP Programming Question:
Download Questions PDF

What are the differences between mysql_fetch_array(), mysql_fetch_object(), mysql_fetch_row()?

Answer:

Answer 1:
mysql_fetch_array() -> Fetch a result row as a combination of associative array and regular array.
mysql_fetch_object() -> Fetch a result row as an object.
mysql_fetch_row() -> Fetch a result set as a regular array().


Answer 2:
The difference between mysql_fetch_row() and mysql_fetch_array() is that the first returns the results in a numeric array ($row[0], $row[1], etc.), while the latter returns a the results an array containing both numeric and associative keys ($row['name'], $row['email'], etc.). mysql_fetch_object() returns an object ($row->name, $row->email, etc.).

Download PHP Interview Questions And Answers PDF

Previous QuestionNext Question
How can we know that a session is started or not?What are the MySQL database files stored in system ?