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
What does $_env mean?
What is repository in php?
What is php variable?
What is difference between static and constant in php?
What is mysqli php?
Does php pass arrays by reference?
What is apache and php?
Tell me how can you pass a variable by reference?
Which function you can use in php to open a file for reading or writing or for both?
What is cakephp framework?
What is difference between print_r and echo in php?
How to remove html tags from data in php?
What are arguments in php?
What are sql functions?
What is the difference between get and post in php?