2nd Query Breaking While Loop!
How can I rewrite this code so that the 2nd nested query doesn't break the while loop?
<?php
require('../config.php');
// Make a MySQL Connection
// Construct our join query
$query = "SELECT ura_items.ProductName, coupons.Product_Name ".
"FROM ura_items, coupons ".
"WHERE ura_items.ProductName = coupons.Product_Name limit 5 ";
$result = mysql_query($query) or die(mysql_error());
// Print out the contents of each row into a table
while($row = mysql_fetch_array($result)){
$name = $row['ProductName'];
$query = "UPDATE ura_items SET Offer='Yes' WHERE ProductName like '$name' ";
$result = mysql_query($query) or die(mysql_error());
echo $name;
echo " updated!";
echo "<br>";
?>
Regards
Reduce stress | Stay focused | Keep positive and balanced