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
How send email in php?
How does csrf token work?
What good is polymorphism?
Explain how you can update memcached when you make changes to php?
How can you pass a variable by reference?
Can you explain, when to use if-else if-else over switch statements?
What is the difference server side and browser side validation?
Is php still used?
What is include in php?
What is the difference between single-quoted and double-quoted strings in php?
What is php crud api?
What is $_ files in php?
Can we use session in mvc?
What is the role of the .htaccess file in php?
What is the major php security hole? How to avoid?