How to search for fields with single quotes from a postgres db?

matthewdesert

New Member
I have a field that may contain single quotes and it is stored in the db with the single quotes. For example the fields may be like this. 1|xyz's friend|21.32|hello, tty's friend|42.2The user inputs a search query based on which the values need to be displayed. For example if the user inputs--> xyz's which is stored in a variable (PHP)I can't do \[code\]select * from table where field LIKE '%variable%' \[/code\]because the variable already has quotes in it. and postgres isn't allowing me to use double quotes around the %variable%I also tried doing something like this \[code\]select * from table where field LIKE E'%variable%' \[/code\]to use escape sequences but that doesn't work too. Any help?
 
Back
Top