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
Why do we show php code in browser?
What is a comment in php?
What is substr() in php? And how it is used?
How do I use isdigit function?
How to invoke a user function?
What is the best way to change the key without changing the value of a php array element?
What is super keyword in c++?
Tell me what does the array operator '===' means?
Which parts of php are case sensitive?
What is good average session duration?
What is the use of token in php?
What is difference between mysql_fetch_array and mysql_fetch_assoc?
Is it possible to destroy a cookie?
Explain which cryptographic extension provide generation and verification of digital signatures?
How do you clear environment variables?