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 factory pattern in php?
Where to put php files in apache server?
What is the use of offset in mysql?
How is it possible to parse a configuration file?
Does session expire on closing browser?
Explain the difference b/w static and dynamic websites?
How do you check is php not empty?
I am trying to assign a variable the value of 0123, but it keeps coming up with a different number, what’s the problem?
What does sign mean php?
How To Get the Uploaded File Information in the Receiving Script?
Explain how is it possible to cast types in php?
How do you explain independent and dependent variables?
How to define a user function?
Explain the difference between array_merge() and array_combine()?
Do you know how to enable error reporting in php?