What is the difference between mysql_fetch_row() and mysql_fetch_array() in PHP when fetching data from a database?

The main difference between mysql_fetch_row() and mysql_fetch_array() in PHP is that mysql_fetch_row() returns a numerical array of the fetched row, while mysql_fetch_array() returns both a numerical and an associative array. If you only need the numerical array, mysql_fetch_row() is more efficient. However, if you need both numerical and associative arrays, mysql_fetch_array() is the better choice.

// Using mysql_fetch_row() to fetch data from a database
$result = mysql_query("SELECT * FROM table");
while($row = mysql_fetch_row($result)) {
    print_r($row);
}

// Using mysql_fetch_array() to fetch data from a database
$result = mysql_query("SELECT * FROM table");
while($row = mysql_fetch_array($result)) {
    print_r($row);
}