How can the foreach loop be effectively used to iterate through and manipulate data retrieved with mysql_fetch_row in PHP?

When using mysql_fetch_row to retrieve data from a MySQL database in PHP, the fetched data is returned as a numeric array. To iterate through and manipulate this data efficiently, the foreach loop can be used. By looping through each row of data with the foreach loop, you can easily access and manipulate the values stored in the numeric array.

$result = mysql_query("SELECT * FROM table");

while ($row = mysql_fetch_row($result)) {
    foreach ($row as $value) {
        // Manipulate the value here
        echo $value . "<br>";
    }
}