What is the difference between mysql_fetch_array and
mysql_fetch_object?




Answers were Sorted based on User's Feedback



Answer / subrat

mysql_fetch_array ? Fetch a result row as an associative
ARRAY, a numeric array, or both
mysql_fetch_object ? Fetch a result row as an OBJECT

Is This Answer Correct ?    24 Yes 2 No

Answer / sumit

mysql_fetch_object : will return the results from database
as objects. fields will be accessible like an objects
i.e $result->name

mysql_fetch_array : will return the results from database as
array. fields will be accessible like in objects
i.e $result[name]

Is This Answer Correct ?    4 Yes 1 No

Answer / jeevabala

mysql_fetch_array : fetch the result as an array
mysql_fetch_object : fetch the result as a object

Is This Answer Correct ?    0 Yes 0 No




Answer / abhay kumar

mysql_fetch_array display all matching record from table as
an array while mysql_fetch_object dispaly first matching
from table as ab object

Is This Answer Correct ?    6 Yes 9 No

Post New Answer



More MySQL Interview Questions

how many table created when we create a table in mysql?

3 Answers  


write a c++ program to add a user to mysql.the user should be permitted to only "insert" into the given database

3 Answers   Infosys, Webyog,


Explain multi-version concurrency control in MySQL?

2 Answers  


suppose data is copie to oracle to sql by using DTS. Actully it taken 2 hours. suppose some day distribute the server in the middle of 2 hours. after how can i get the data ?

0 Answers   ACC,


if we want to load data from a text file into a mysql table, but the columns in table are 1st: code(int) and 2nd: city(varchar), but in text file the format is 1st cityname and then code separeted by delimeters. how to load?

2 Answers  


ru compare the 2 null values?

2 Answers   ACC,


How to define numeric 9(3) in db2 table without decimal point??

0 Answers  


What is the main different between Null and NOT Null. Difference between Primary and Unique Key. How to Check the database from which application is it possibe.

6 Answers  


I have two sql database at different PC.how can link b/w database and database tables.

2 Answers  


Explain data type TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP .

2 Answers   Zensar,


How internally data stores in MyISAM and INNODB table types?

0 Answers   Zensar,


is it possible to assign two primary key in a table

8 Answers   IBM,




Categories