Win Surprise Gifts!!!
Top 5 Contributors of the Month
Post New Question
Subscribe to Forum
What is the difference between mysql_fetch_object and mysql_fetch_array in PHP?
September 19, 2012
What is the difference between mysql_fetch_object and mysql_fetch_array in PHP? please Define in coding
Posted Date: March 11, 2013 Points: 20
Mysql_fetch_object returns the result from the database as objects while mysql_fetch_array returns result as an array. This will allow access to the data by the field names. E.g. using mysql_fetch_object field can be accessed as $result->name and using mysql_fetch_array field can be accessed as $result->[name]
1. mysql_fetch_row($result):- where $result is the result resource returned from a successful query executed using the mysql_query() function.
$result = mysql_query("SELECT * from students);
while($row = mysql_fetch_row($result))
2. mysql_fetch_array($result):- Return the current row with both associative and numeric indexes where each column can either be accessed by 0, 1, 2, etc., or the column name.
$row = mysql_fetch_array($result)
3. mysql_fetch_assoc($result): Return the current row as an associative array, where the name of each column is a key in the array.
$row = mysql_fetch_assoc($result)
If this post helps you mark it as answer
To post reply
Related Questions Related Questions
difference between an EXE and a DLL
Difference Between console application and windows application?
Difference between Web Garden and Web Farm
Difference Between Response.Write and Response.Output.Write?
Difference between Language and package
Difference between JDK and SDK
Difference Between SDK and IDE
What is the difference between Get and Post method?
What's the difference between Response.Write() andResponse.Output.Write()?
Difference between Factory, Abstract Factory and Inheritance
Latest Forum Questions From The Same Category
in hrml5 banners what JS file contains?
How to create svg text circle /upper curve according height and width
How to loop image details in array with prev/next functionality?
Microsoft JScript runtime error:
SpringOne 2012, a one-of-a-kind conference for application developers..
How to run multiple stores in OpenCart?
What is SDLC can you explain phases of each and every one ?
Find more Forum Questions on C#, ASP.Net, Vb.Net, SQL Server and more
Quick Links For Forum Categories:
Hall of Fame
Terms of Service
Tell A Friend