3

Trying to enter a value into a mediumblob field in a mySQL table but I'm getting:

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 id = 40' at line 3

INSERT INTO 'Picture'
VALUES (efvr)
WHERE id = 40 

What's wrong with this statement, and how can it be fixed?

1
  • 1
    I think most of us will need some more information to troubleshoot this one. It's pretty clear that the query is not syntactically correct, but since I'm not exactly sure what you're trying to do, I'm not sure how to tell you to fix it. What is "efvr"? Is that from another table? Are you actually trying to update a record in Picture with id = 40, or are you trying to add one? Or, are you trying to select a value from another table where id = 40? We need more information.
    – Andrew
    Oct 12, 2010 at 21:56

1 Answer 1

5

You can't have a WHERE clause on an INSERT. If you're trying to change an existing row, you need to use an UPDATE instead.

2
  • +1 ... The OP should also wrap the efvr value into single quotes, and use backticks instead of quotes for identifiers (like table names). Oct 12, 2010 at 21:57
  • @Daniel: Correct, that's also something you would need to do. Oct 12, 2010 at 21:58

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.