So I'm currently new to PDO and its syntax. Can somebody help me with correctly doing the following SQL query in PDO:
SELECT * FROM Menu WHERE ID IN ([Array of IDs])
I currently have the following but I suspect it's wrong:
public function basket($ids) {
require dirname(__FILE__) . '/../../dbconnect.php';
$sql = "SELECT * FROM `Menu` WHERE `ID` IN (:ids)";
$stmt = $pdo->prepare($sql);
$stmt->bindValue(':ids',$ids);
$stmt->execute();
$result = $stmt->fetchAll();
echo json_encode($result);
}
Is my line with the SQL query correct ? I seem to be getting no results returned and no errors in my log files.