Hi Guys
Im a little stuck with the following code...
Im trying to add 10.00 to every price in the table but cant seem to get it to work
also on using echo it seems fine excepts it misses the 1st & last productid aswell as not updating the table
can anyone help please ?
<?
include "conf.php";
$point=".00";
$upby="10.00";
mysql_connect($host,$user,$pass);
@mysql_select_db($db) or die( "Unable to select database");
$query="SELECT * FROM pricing";
$result=mysql_query($query);
$num=mysql_numrows($result);
$i=-0;
while ($i < $num) {
$price=mysql_result($result,$i,"price");
$productid=mysql_result($result,$i,"productid");
$price2 = $price + $upby;
mysql_connect($host,$user,$pass);
@mysql_select_db($db) or die( "Unable to select database");
$query="UPDATE pricing SET price='$price2$point' WHERE productid ='$productid'";
mysql_close();
$i++;
}
?>