What is the difference between mysql_fetch_object and
mysql_fetch_array?
Answer Posted / ghan shyam
mysql_fetch_object : will return the results from database
as objects. fields will be accessible like in objects
i.e $result->name,$result->cust_name
mysql_fetch_array : will return the results from database as
array.
you have to define array type in second parameter of mysql_fetch_array function.
fields will be accessible like
$result[name],$result[cust_name] (if type =MYSQL_ASSOC)
or like
$result[0],$result[1] (if type =MYSQL_NUM)
or like
$result[name],$result[cust_name],$result[0],$result[1] (if type=MYSQL_BOTH)
| Is This Answer Correct ? | 6 Yes | 5 No |
Post New Answer View All Answers
Explain what is smarty?
What are properties in php?
Where is session id stored?
Explain me differences between get and post methods?
Write a php script to get the largest key in an array?
What are classes in php?
What is php dependency injection?
How to access a global variable inside a function?
What is php default argument?
What are the benefits of using php?
What are magic methods?
What is meant by pdo in php?
What is the difference between null and empty?
Tell me how to create a session? How to set a value in session? How to remove data from a session?
What is the difference between the functions strstr() and stristr()?