hi i'm getting an invalid parameter number when executing php PDO select statement with JOIN
and LIKE
below is my code
try {
$search = ('SELECT torrents.ID,torrents.ImgUrl,torrents.Title,songs.Song from torrents INNER JOIN songs ON torrents.ID = songs.ID where torrents.Title Like :search_query or songs.Song Like :search_query');
$search = $a->prepare($search);
$search_query = "%$search_query%";
$search->execute(array(':search_query' => $search_query));
$search_query = $search->fetchAll(PDO::FETCH_ASSOC);
} catch (PDOException $e) {
echo $e->getMessage();
}
I have tried using placeholders torrents.Title Like ? OR songs.Song Like ?
and execute it with $search->execute($search_query);
Still i'm getting an error.