or similar.SELECT * FROM foo WHERE bar LIKE '%it's not a problem%'
OK for an example of it not working? If I do this:
$str = $dbh->quote("it's not a problem"); $sth = $dbh->prepare( "SELECT * FROM practice WHERE name LIKE '%$str%'" ) || die "Error: " . $dbh->errstr; $sth->execute() || die "Error: " . $dbh->errstr;
I get an error:
Error: You have an error in your SQL syntax. Check the manual that cor +responds to your MySQL server version for the right syntax to use nea +r 'it\'s not a problem'%'' at line 1 at /foo/bar.cgi line 29.
What I'm saying is, the quote() function puts backslashes before my apostrophes. But that's not what I need if it's LIKE (something containing an apostrophe). What am I missing?
($_='kkvvttuubbooppuuiiffssqqffssmmiibbddllffss')
=~y~b-v~a-z~s; print
In reply to Re^2: Quoting Strings For SQL LIKE queries
by Cody Pendant
in thread Quoting Strings For SQL LIKE queries
by Cody Pendant
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |