computerpro
In Runtime
- Messages
- 238
I am trying to check 2 columns for a particular pattern.
Here is the code:
$query = "SELECT * FROM pages WHERE title LIKE '%$v%' OR desc LIKE '%$v%'";
The error I got
Query failed: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'desc LIKE '%testsearch%'' at line 1
I need to check the same columns, well actually 3 columns, all for the same variable value.
If I take out the OR and thereafter, it works, but I need that.
Any ideas?
Here is the code:
$query = "SELECT * FROM pages WHERE title LIKE '%$v%' OR desc LIKE '%$v%'";
The error I got
Query failed: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'desc LIKE '%testsearch%'' at line 1
I need to check the same columns, well actually 3 columns, all for the same variable value.
If I take out the OR and thereafter, it works, but I need that.
Any ideas?