what is the difference between mysql_fetch_array() and
mysql_fetch_row()?

Answer Posted / sekhar

mysql_fetch_array($resultset, [return type]);
return a row from the result set as an array
return type values:
MYSQL_NUM If return type is mysql_num, we have to use the
column position in the result set.
MYSQL_ASSOC: if return type is mysql_assoc, we have to fetch
the data by using column names in result set.
MYSQL_BOTH: if return type is mysql_both, we have to fetch
the data by using column index or column names in the result
set.

mysql_fetch_rows($resultset);
retrives the row from the result set and move the pointer to
the next record.
we have to retrive the data from the row by using the filed
position in the result set.

mysql_fetch_assoc($resultset);
retrives a row from the resultset as an associative array.
we have to retrive the data by using the columns name in the
result set.

mysql_fetch_object($resultset);
return the row as an object. we have to fetch the data in
the row fetch the column names in the result set as $row->
column name in the result set.

Is This Answer Correct ?    11 Yes 10 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What are the advantages of oops in php?

545


Is echo a function in php?

501


How many escape sequences are recognized in double-quoted strings in php?

529


How is a session id generated?

523


Write a php function to convert all null values to blank?

775






Which php framework is fastest?

502


What is polymorphism php?

494


What are the advantages of indexes in php?

558


How can image properties be retrieved in php?

535


What backslash character will match whitespace?

559


Is php used anymore?

519


What is the main difference between require() and include()?

476


What Is a Persistent Cookie?

605


How to update memcached when you make changes to php?

529


What is the special meaning of __sleep and __wakeup?

567