What is the difference between mysql_fetch_object and
mysql_fetch_array?
Answer Posted / rupal
mysql_fetch_row ::Return row as aan enumrated array and each
line contain a unique ID .example.
$result=mysql_query($query);
while($row=mysql_fetch_row($result))
{
print $row[0] ;
print $row[1] ;
print $row[2] ;
}
mysql_fetch_array ::Return row as anassociative or an
enumrated array or both which is default .you can refer to
outputs as databases fieldname rather then number .example.
$result=mysql_query($query);
while($row=mysql_fetch_array($result))
{
print $row['name'] ;
print $row['address'] ;
print $row['city'] ;
}
mysql_fetch_object :: it return as an object on the place of
array.
$result=mysql_query($query);
while($row=mysql_fetch_object($result))
{
print $row->name ;
print $row->address ;
print $row->city ;
}
| Is This Answer Correct ? | 18 Yes | 1 No |
Post New Answer View All Answers
What is php explain how php works?
What is php resource type?
What is the use of array_count_values() in php?
In php, objects are they passed by value or by reference?
What is the use of nl2br() in php?
How to make database connection in php?
What are regular expressions in programming?
What is the difference between for and foreach loop in php?
How to read one character from a file?
Is array empty php?
Can you give example for trait in php?
How to generate a character from an ascii value?
How can I embed a java program in php file and what changes have to be done in php.ini file?
Explain what does the unlink() function means?
What is difference between static and final in php?