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
What is the function of trim?
What is magic quotes?
What is different between software and app
What are interfaces in php?
How do http requests work?
What is substr in php?
What does the arrow mean in php?
What is api used for?
Write a php function to convert all null values to blank?
Explain me what is the use of header() function in php?
What software is required to run php?
Write logic to print Floyd's triangle in PHP?
Why php language is used?
Which framework is best for php development?
Can a trait extend a class php?