Reputation: 9293
how to select rows where column story
contains <p class='dg'>
I tried all or nearly all variations with quotes and escapses
for example:
$sq = "select * from arts where story like '%<p class=\'dg\'>%' order by ind asc"
$sq = "select * from arts where story like '%<p class=\"dg\">%' order by ind asc";
Upvotes: 1
Views: 114
Reputation: 562861
This looks like PHP code. The backslash is special in PHP syntax as well as MySQL syntax. To get a literal backslash in the string, use a double backslash:
$sq = "select * from arts where story like '%<p class=\\'dg\\'>%' order by ind asc";
Alternative: In SQL, string literals allow a pair of quote characters to become like a single literal quote character. So you can do the following:
$sq = "select * from arts where story like '%<p class=''dg''>%' order by ind asc";
Upvotes: 2