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
Which is better php or wordpress?
Write a program to display reverse of any number?
What is a php web application?
What is super keyword in php?
In php, objects are they passed by value or by reference?
How would you declare a function that receives one parameter name hello?
What is laracast?
What are the differences between require and include?
Explain what is the difference between mysql_fetch_array() and mysql_fetch_assoc()?
Is php still in demand?
Explain what does $_server means?
How to insert an new array element in array?
What are the uses of php language?
What is the value for this auto incremented field user_pri_id?
What are the __construct() and __destruct() methods in a php class?