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 the current stable version of php? What advance thing in php7?
Tell me what is the importance of "action" attribute in a html form?
What is the use of preg_match in php?
Which is the correct way to check if a session has already been started ?
What is the function of string in c?
Maine 12th ke bad 2 years ka web designing ka course kiya hai. Php me achcha hu. Ek fresher ko is field me kitna mil sakta hai ?
What is url encoding and decoding in php?
How long will it take to learn php?
How to convert a string to uppercase in php?
How to return ascii value of character in php?
What is csrf mvc?
What is form action php?
What are the different opening and closing tags available in PHP?
How to generate a form?
What is the difference between include and require?