I have 2 values that I’m suppling my script – I want to search for any one of those datas. How do I write my query like this:
SELECT * FROM table WHERE id = '".$id."' or "name='".$name."';
my problem is escaping the quotes in the query.
Any help will be appreciated.
You may use curly brackets to avoid confusion with escaping characters as follows:
You may also consider using wildcards such as
%$letter%to search for word anywhere in thenamefield as:SUGGESTTION:
You should always use
idfields asintegerfor better performance.