Jump to content

Problems with code to change value


OriginalSunny

Recommended Posts

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>&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp
&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp";
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.
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.