"MySQL's way of escaping a quote is to double it."
Actually, that's not something specific to MySQL; it's part of the SQL standard.
davido's answer is a good one. In the spirit of "there's more than one way to do it"...
$dbh->do(<<'GO'); UPDATE table_name SET `fieldname`=REPLACE(`fieldname`,'‘','''') GO
... or ...
$dbh->do("UPDATE table_name SET `fieldname`=REPLACE(`fieldname`,'‘','' +'')");
... or ...
$dbh->do('UPDATE table_name SET `fieldname`=REPLACE(`fieldname`,\'‘\', +\'\'\'\')');
... or ...
$dbh->do(q(UPDATE table_name SET `fieldname`=REPLACE(`fieldname`,'‘',' +''')));
Lastly, if you've got non-ASCII characters in your source code (such as your "smart quote"), make sure your editor is set up to save your script as UTF-8; and make sure you include the pragma use utf8 somewhere near the top of your script.
In reply to Re: DBI and some complicated quotes
by tobyink
in thread DBI and some complicated quotes
by Cody Fendant
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |