Which is the best method to fetch the data from mysql?
1.mysql_fetch_array()
2.mysql_fetch_object()
3.mysql_fetch_row()
4.mysql_fetch_assoc()
Answer Posted / mervin thomas
I think all mysql_fetch_array() is the best one, since we
can get the value of the records using the numeric index (as
numbers) or using the string index (as column).
mysql_fetch_array () => fetches the records using the two
way index method,
(ex). $record[0];
$record['id'];
gives the same value.
mysql_fetch_row() fetches the records using the numerical index
ex. $record[0];
mysql_fetch_assoc() fetches the records using the string
index and returs the records as associative array
ex. $record['id'];
mysql_fetch_object() fetches the records as the object.
ex. $record->id;
| Is This Answer Correct ? | 13 Yes | 1 No |
Post New Answer View All Answers
What is foreach loop in php?
Is php better than python?
What is the difference between unset and unlink?
What is the main difference between require() and require_once()?
how to use http headers inside php? Write the statement through which it can be added?
Tell me what is pear?
What is crypt () in php?
Do I need to install php after xampp?
Is age nominal or ordinal?
What is the capacity of mysql database?
How can you get the size of an image in PHP?
What language is php written in?
What does addslashes do in php?
How error handling is being handled by php?
Where do we use get and post?