what is the difference between mysql_fetch_array() and
mysql_fetch_row()?
Answer Posted / piyush patel
mysql_fetch_array:
This function return row as an associative array, a numeric
array, or both. 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['mobile']";
}
mysql_fetch_row :
This function return row as an enumrated array and each row
contain a unique ID.
example:
$result=mysql_query($query);
while($row=mysql_fetch_row($result))
{
print "$row[0]";
print "$row[1]";
print "$row[2]";
}
| Is This Answer Correct ? | 30 Yes | 12 No |
Post New Answer View All Answers
Where do I run php code?
What is the difference between $var and $$var?
How to execute a function in php?
What are the advantages of triggers?
What are the ways to define a constant in php?
Which will start a session?
What is a base url?
Explain php explode() function.
What is trim function in php?
What does the array operator '===' means?
How many types of array are there in php?
Tell me is it possible to protect special characters in a query string?
Is learning php easy?
How to convert a string to uppercase in php?
What are the advantages of php mysql?