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

Answer Posted / srinivas1982

sorry for my mistake. here is the answer
the functions mysql_fetch_row(), mysql_fetch_array() and
mysql_fetch_object() return one row from the result, and
then move the pointer on. If there are no more rows to
fetch, it returns false. This means you can you use a very
simple while loop:

$result=mysql_query("SELECT * FROM sometable");
while($row=mysql_fetch_row($result)){
do_something_with_row();
}

This will automatically terminate when the last row has been
processed.

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).

Is This Answer Correct ?    60 Yes 12 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Who is known as the father of php?

551


Which is faster for or foreach php?

491


How to get a random value from a php array?

544


What are the 5 types of data?

555


What is the use of extract function in php?

502






"mysql_fetch_row — Get a result row as an enumerated array",this sentence comes from the PHP offical manual.However ,i can not understand the words "enumerated array".I need some help.Thanks a lot to everyone that reply.

1518


What is default session time and path in PHP. How to change it?

532


Which parts of php are case sensitive?

484


What is the special meaning of __sleep and __wakeup?

567


What is session in c#?

519


What is a substring in php?

565


Is PHP runs on different platforms (Windows, Linux, Unix, etc.)?

518


am from coimbatore.am learning php&mysql. what will be the approx salary for me if i get a job in coimbatore.

1545


Explain mail function in PHP with syntax?

549


What is uri routing?

517