OriginalSunny Posted April 17, 2006 Share Posted April 17, 2006 Hi,My form outputs the quantity and productID correctly on the form but i can't seem to decrease the amount for quantity by the quantity output.while($row1 = mysql_fetch_array($result1)) { echo "<td><b>"; echo ''.$row1['quantity'].''; echo "</b></td>                   "; echo "<td><b>"; echo ''.$row1['stockID'].'';[b] $sql = REPLACE INTO Stock (stockAmt) VALUES (" stockAmt - ''.$row1['quantity'].'' ") WHERE stockID = " ''.$row1['stockID'].'' "; mysql_query($sql);[/b]}The problem is the code in bold. I don't get where i am going wrong as the correct values are ouput but when i use the bit to replace the value, it causes a blank output so there is an error somewhere. If you know what it is please let me know.Thanks. Quote Link to comment Share on other sites More sharing options...
poirot Posted April 17, 2006 Share Posted April 17, 2006 Try this one:[code]$sql = 'REPLACE INTO Stock (stockAmt) VALUES (" stockAmt - ' . $row1['quantity']. ' ") WHERE stockID = "' . $row1['stockID']. ' " ';[/code] Quote Link to comment Share on other sites More sharing options...
OriginalSunny Posted April 18, 2006 Author Share Posted April 18, 2006 Tried it, still a blank page. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.