I was asked to create a companies search on our database using phone number or a name. The problem is they both are in the same text box like so:
<input type="text" name = "nameOrPhone" />
So I need to use this parameter to make the search look like this:
SELECT * FROM table WHERE name LIKE '$nameOrPhone%' OR phone LIKE $nameOrPhone%
I get a syntax error from MySql.
The problem is i want to use this to search in two columns. Any ideas how to fix that?
Look at the highlighting it is showing your problem. You forgot to put quotes around it.
This is what you are probably looking for: