Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

INSERT INTO error in MySQL

Tags:

mysql

Notice: 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 
'usage VALUES('16','143','ew','weff','25-3-2010','8.00 AM','22-3-2010','10.00 AM''

at line 1 in:

INSERT INTO usage 
VALUES('16'
      ,'143'
      ,'ew'
      ,'weff'
      ,'25-3-2010'
      ,'8.00 AM'
      ,'22-3-2010'
      ,'10.00 AM'
      ,'wfsdc'
      , '34'
      ,' frsdfr '
      ,'TEST 1'
      ,'ISMAIL SALLEH'
      ,'efsdc'
  )

I've no idea where is the error... I'm staring on this for 2 hours, but really cannot find the error.

like image 209
user273551 Avatar asked Jan 24 '26 04:01

user273551


1 Answers

Try:

INSERT INTO `usage` VALUES ....

You simply need to wrap the table name in backticks, because USAGE is a reserved word in MySQL.

Source: MySQL Docs: Reserved Words

like image 149
Daniel Vassallo Avatar answered Jan 25 '26 19:01

Daniel Vassallo



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!