Reputation: 38190
I try this in PHPMyadmin:
Update wp_1_posts
SET post_content='<strong>Hello </strong> <a href="http://stackoverflow.com">stackoverflow</a> you think you're good at sql.\n then answer\n'
WHERE post_ti<tle = 'stupid example'
and it says bad syntax. Why ?
Upvotes: 0
Views: 459
Reputation: 935
You have to escape the single quote in the word you're
to make it you\'re
in your statement.
Upvotes: 2
Reputation: 731
You have to escape quotes inside string (read the manual).
Update wp_1_posts SET post_content='<strong>Hello </strong> <a href="http://stackoverflow.com">stackoverflow</a> you think you\'re good at sql.\n then answer\n' WHERE post_title = 'stupid example'
Upvotes: 1
Reputation: 401002
With MySQL, single-quotes inside a string have to be escaped, putting a \
before them :
'this is a string with a \' quote inside of it'
As a reference, you can take a look to this section of the MySQL manual :
In your case, your query should look like this :
Update wp_1_posts
SET post_content='<strong>Hello </strong> <a href="http://stackoverflow.com">stackoverflow</a> you think you\'re good at sql.\n then answer\n'
WHERE post_title = 'stupid example'
Note the \
I've added in think you\'re good
.
Upvotes: 4
Reputation: 12721
You can see it in your post. The red text ends at the ' in you're. You need to escape the quote. You can simply add \ before it. you\'re.
Upvotes: 3