2

i try to update simple data to table name "order" but i still get error.

i try to many version query but still same ;

first try :
$result = mysql_query("UPDATE order SET order_status_id=200 WHERE order_id=75") or die(mysql_error()); 

second try :
$result = mysql_query("UPDATE order SET order_status_id='200' WHERE order_id='75'") or die(mysql_error()); 

error ;

first try : 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 'order SET order_id=200 WHERE order_id=75' at line 1

second try : 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 'order SET order_status_id='200' WHERE order_id='75'' at line 1

Table structure

order_id    int(11)
order_status_id     int(11)

i try to update others table just to make sure my query correct and all table can update.

*Im using Opencart and my site use https.

Thanks.

ruslyrossi
  • 366
  • 1
  • 6
  • 21

1 Answers1

7

order is a reserved word in MySQL. You need to escape it with backticks:

UPDATE `order` SET order_status_id=200 WHERE order_id=75

See MySQL reserved words

juergen d
  • 201,996
  • 37
  • 293
  • 362