SELECT * FROM foo WHERE bar LIKE '%it's not a problem%' #### $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; #### Error: 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 'it\'s not a problem'%'' at line 1 at /foo/bar.cgi line 29.