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
Who is known as the father of php?
Which is faster for or foreach php?
How to get a random value from a php array?
What are the 5 types of data?
What is the use of extract function in php?
"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.
What is default session time and path in PHP. How to change it?
Which parts of php are case sensitive?
What is the special meaning of __sleep and __wakeup?
What is session in c#?
What is a substring in php?
Is PHP runs on different platforms (Windows, Linux, Unix, etc.)?
am from coimbatore.am learning php&mysql. what will be the approx salary for me if i get a job in coimbatore.
Explain mail function in PHP with syntax?
What is uri routing?