I am trying to update multiple rows in a mysql database and am having difficulty. This only seems to update if there are two or less calls to update. I think maybe a foreach loop would work but I am a little confused on how to implement it. Any ideas?
<?php
// set a variable with the database name
$database_name = "_websites";
// attempt to connect to database and store result
$dbh = mysql_connect("localhost","dude","admin");
// check the result of the connection attempt
if (!mysql_select_db($database_name)) {
echo "Can't Select $database_name";
}
$sql = "UPDATE prices SET price='$mareci' WHERE name='ez' AND brand='m'";
$sql = "UPDATE prices SET price='$cameci' WHERE name='ez' AND brand='cel'";
$sql = "UPDATE prices SET price='$wineci' WHERE name='ez' AND brand='wn'";
$sql = "UPDATE prices SET price='$saleci' WHERE name='ez' AND brand='s'";
$sql = "UPDATE prices SET price='$pareci' WHERE name='ez' AND brand='pt'";
$sql = "UPDATE prices SET price='$keneci' WHERE name='ez' AND brand='kt'";
$sql = "UPDATE prices SET price='$beneci' WHERE name='ez' AND brand='Bes'";
$sql = "UPDATE prices SET price='$paleci' WHERE name='ez' AND brand='pll'";
$sql = "UPDATE prices SET price='$luceci' WHERE name='ez' AND brand='l se'";
$sql = "UPDATE prices SET price='$cheeci' WHERE name='ez' AND brand='chld'";
$sql = "UPDATE prices SET price='$phieci' WHERE name='ecz' AND brand='phis'";
$sql = "UPDATE prices SET price='$roteci' WHERE name='ez' AND brand='rons'";
$sql = "UPDATE prices SET price='$lmseci' WHERE name='ez' AND brand='M'";
$sql = "UPDATE prices SET price='$duneci' WHERE name='ecz' AND brand='ill'";
mysql_query($sql);
?>