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 MariaDB server version for the right syntax to use near 'LIKE 'sacasc' ORDER BY question_id DESC LIMIT 0, 5' at line 1 in C:\xampp\htdocs\AdminLTE-master\library\Search.php:21 Stack trace: #0 C:\xampp\htdocs\AdminLTE-master\library\Search.php(21): PDOStatement->execute() #1 C:\xampp\htdocs\AdminLTE-master\search.php(16): Search->searchQuestion('sacasc') #2 {main} thrown in C:\xampp\htdocs\AdminLTE-master\library\Search.php on line 21
public function searchQuestion($search)
{
//
$sql = "SELECT * FROM questions WHERE short_description = LIKE '" . $search . "' ORDER BY question_id DESC LIMIT 0, 5";
$query = $this->db->pdo->prepare($sql);
$query->bindValue(':search', $search);
$query->execute();
$result = $query->fetchAll();
return $result;
}