If sinkQty field in the given record is not equal to the existing value, then want current date NOW() otherwise keep existing date. The update fails. Any words of wisdom would sure help on this project!
$tbl_name="sink";
$count=mysql_num_rows($result);
$sinkid = $_POST['sinkID'];
$qty = $_POST['sinkQty'];
$qtyonorder= $_POST['sinkQtyOnOrder'];
$desiredqty= $_POST['sinkDesiredQty'];
$posted = $_POST['sinkPosted'];
for($i=0;$i<$count;$i++)
{
$sql1=("UPDATE $tbl_name
SET sinkPosted = IF ( sinkQty != $qty[$i] ,NOW(), $posted[$i]) ,
sinkQty=$qty[$i], sinkDesiredQty=$desiredqty[$i],
sinkQtyOnOrder=$qtyonorder[$i]
WHERE sinkID=$sinkid[$i]");
$result1=mysql_query($sql1);
}
Aucun commentaire:
Enregistrer un commentaire