INSERT INTO orders_total SET `title`='Discount Coupon:', `text` = '-$40.00', `value` = '40.00' WHERE `orders_id` = '15474' AND `class`='ot_coupon
It gives the following mysql error:
#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'WHERE `orders_id` = '15474' AND `class`='ot_coupon'' at line 1
Any idea what I am doing wrong?
INSERTstatements are meant to insert new rows, now update existing ones, and aWHEREclause is therefore invalid in anINSERT. You intended toUPDATE.Edit after comments:
If this was intended to be an insert rather than an update, it cannot have dependencies on conditions like
orders_id = 15474. If you are inserting a new row, you need to insert those values as well.