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
How can we enable error reporting in php?
Where php basically used?
write a prog using insert,update,delete in this manner as output? name: phno. add button 1.name phno. edit button delete button 2.
Why laravel is the best php framework in 2019?
Explain me what is the w3c?
How check variable is set or not in php?
How error handling is being handled by php?
Can a super () and this () keywords be in same constructor?
Why triggers are used in mysql?
What are global variables in php?
Which character is used to match exactly one character?
How to call a php function from another php file?
How easy is php?
What is the interface in php?
Explain how you can update memcached when you make changes to php?