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


Please Help Members By Posting Answers For Below Questions

What is the main difference between require() and include()?

472


What exactly is validating and sanitizing?

611


Why do we need abstract class in php?

493


What does the scope of variables mean?

519


What are the different ways to login to a remote server?

472






Explain php parameterized functions.

544


Explain the difference between urlencode and urldecode?

515


Is strcmp case sensitive?

504


Do you know what is use of count() function in php?

507


What are the differences between mysqli_connect and mysqli_pconnect?

523


How can we display information of a variable and readable by a human with php?

525


What are the differences between PHP3 and PHP4 and PHP5? what is the current stable version of PHP?

612


What is regular expression in javascript?

440


How arrays are used in php?

540


How can we create a database using php?

588