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
Explain what is memcache?
Explain me what are the 3 scope levels available in php and how would you define them?
Is it more secure to use cookies to trfer session ids?
What type of comments are supported by PHP.
Define about declare construct?
How can a cross-site scripting attack be prevented by php?
What is $_ files in php?
When to use get and post request?
Is empty function c++?
Difference between array_combine and array_merge?
Can you specify the "new line" character in single-quoted strings?
What is the differences between $a != $B and $a !== $B?
What is framework in php?
What is list in PHP?
What websites use php?