I prefer opium myself
but the effect is much the same!
I had tried addslashes() as part of the odbc_exec() function call and also as part of the assignment statement for the variable. Neither had any effect.
A dynamic query that doesn't use the LIKE (which necessitates the 's) works as expected.
Echoing the variable ($sql) and using the result within Management Studio, minus the \s (SELECT * from dbname WHERE field LIKE 'a%'), works as expected. The echoed variable value was SELECT * FROM dbname WHERE field LIKE \'a%\'
I would pull my hair out but they may not recognize me at the opium den and I gots to have some fun!