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

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

2 Comments

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.