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
What are the differences between mysqli_connect and mysqli_pconnect?
Explain about the $_GET variable of PHP?
How to download and install php on windows?
Tell me what does $_env means?
What is string function sql?
What is super keyword in php?
What is the best way to avoid email sent through php getting into the spam folder?
What are the special characters you need to escape in single-quoted stings?
Explain how does one prevent the following warning ‘warning: cannot modify header information – headers already sent' and why does it occur in the first place?
How a variable is declared in php?
Is php worth learning in 2019?
What is overriding in php?
What is the use of "echo" in php?
How can you execute php script from the command line?
Which php framework is best for web development?