I wrote a very simple Perl script that contains the following line.
my $q_it = $dbh->prepare('SELECT customdata.Field_ID,
customdata.Record_ID,
customdata.StringValue
FROM customdata
WHERE customdata.Field_ID='\'10012'\' && (StringValue LIKE '\'1%'\' OR StringValue LIKE '\'2%'\' OR StringValue LIKE '\'9%'\');
');
in which customdata is a table.
However, I always got syntax error complaining about the “WHERER” clause:
Backslash found where operator expected at /home/wblocaladmin/Robert_2.pl line 18, near "'10012'\"
Since it is a quote inside quote statement, so I tried escaping the single quote like one above. Could any body help me spot where I went wrong?
Thanks!
Why you don’t just use double quotes to enclose the string ?