$updatestock = "UPDATE products SET products_quantity='$stocklevel' WHERE products_id=$products_id"; $result = mysql_query($updatestock) or die ('Your stock query doesn't work: ' . mysql_error());
The php page it's in appears to load fine, doesn't even have any errors, but the field in the DB is ALWAYS updated to 0, no matter what the $stocklevel contains, even though it echos a completely different value on the page. I did have the same query before, but without the ' marks around $stocklevel and that displayed the error saying there was incorrect syntax near '=73' (if 73 was $stocklevel)
What I especially don't get is that just above that query in the php code, I have this one for updating the price, which works absoloutley fine and is in EXACTLY the same format:
$updateprice = "UPDATE products SET products_price=$price WHERE products_id=$products_id"; $result = mysql_query($updateprice) or die ('Your price query doesn't work: ' . mysql_error());
This one works absoloutley fine all the time, even when I was getting an error messege for the stock one when I didn't have the ' marks around $stocklevel, and as you can see is in exactly the same format as the stock one. I don't understand it at all.
Another weird thing is the stock update query was working fine until I stuck the "or die" bit on the end. Ironically, maybe the error message is causing the problem?