Consider this SQL statement:
SELECT x from y WHERE col1 = '\'abc\' is not allowed';
I am trying to submit the above statement to my database using PHP 5 with odbc. When I run this using odbc_exec it returns no rows.
However if I enter this statement into isql (the unixodbc client query tool) then it runs just fine.
Now, to get the above sql statement to run from php with odbc_exec, I have to change the '\ to '' (two single quotes). So the statement becomes:
SELECT x from y WHERE col1 = '''abc'' is not allowed';
The problem with two single quotes is that I really do not want to be passing around unescaped quotes for fear or sql injection vulnerabilities.
So why do you think \' will not work when passed through php and odbc_exec when it works just fine when typed into a sql query tool like isql?
Thanks!