I want to use a simple query for search.
This query is working fine in another page and with another table. I just copied and pasted it.
Here is query
$stmt = $pdo->prepare("SELECT * FROM _all_users WHERE fullname LIKE '%".$q."%' OR mobile LIKE '%".$q."%' ORDER BY time_stamp DESC");
$stmt->execute();
It must be working. But im getting this error
Fatal error: Uncaught PDOException: SQLSTATE[42000]: Syntax error or access violation: 1064 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 'OR mobile LIKE '%848%' ORDER BY time_stamp DESC LIMIT 15 OFFSET 0' at line 1 in /var/www/_am/ajax/getLists.php:171 Stack trace: #0 /var/www/_am/ajax/getLists.php(171): PDO->prepare('SELECT * FROM _...') #1 {main} thrown in /var/www/_am/ajax/getLists.php on line 171
Any idea?