I'm trying to fetch multiple ids on database, but PDO is only returning result from the first id. I'm suspecting PDO has a problem with the comma.
Edit: on mysql this query is working normal, but not on PDO.
$resources = getResourcesByID("2,3,4,5");
function getResourcesByID($id)
{
$PDO = getconnection();
if ($PDO !== NULL) {
$sql = "SELECT * FROM `resources` WHERE id IN (:id);";
$stmt = $PDO->prepare($sql);
$stmt->bindParam(":id", $id, PDO::PARAM_STR, 255);
$stmt->execute();
return $stmt->fetchAll(PDO::FETCH_ASSOC);
}
return array();
}