3
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.

3
  • 1
    -1 We're programmers too, not magicians. It is impossible to tell what the problem could be just based on that SQL. We need to see the table design, and a sample record would be helpful too. Commented Mar 11, 2010 at 14:39
  • 1
    Please post the structure for that table. Are you missing a field? Commented Mar 11, 2010 at 14:42
  • i've check all the table field..there no missing field Commented Mar 11, 2010 at 14:47

2 Answers 2

6

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

Sign up to request clarification or add additional context in comments.

4 Comments

when i run at sql..the error become near 'usage VALUES('16','143','ew','weff','25-3-2010','8.00 AM','22-3-2010','10.00 AM'' i dont know to solve it...i 've compare to the other code...but it look similar...
wrap the table name in backticks, not quotes. INSERT INTO usage (not 'usage')
ok..it almost done..it the new error occurs Column count doesn't match value count at row 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 what is the coloums count?
thanks daniel...the error because there where 'status' field in the table...is it possible if i want to insert data into table with 1 field without data..
0

Have you tried retyping it from scratch in case you put the line together using cut and paste and maybe accidentally included an invisible control character which makes the SQL parser choke...?

1 Comment

i also think like that...but i've 2time retyping it...and really2 mess with this...

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.