I have two tables, I want to select from the first the ID of Salles for each Responsible (he may have many -> array()) .
so I want to select all the salles this responsible have, and I did this statement (which returns an empty array and I am unsure of why):
$sels = $db->prepare("SELECT salle FROM salleresp WHERE resp = :resp");
$sels->bindParam(':resp',$rsb['matricule']);
$sels->execute();
$rss = $sels->fetchAll(PDO::FETCH_ASSOC);
$questionmarks = str_repeat("?,", count($rss)-1) . "?";
$selectSalle1 = $db->prepare("SELECT * FROM salle WHERE salleId IN ($questionmarks) ");
$selectSalle1->execute($rss);
$showAll=$selectSalle1->fetchAll(PDO::FETCH_ASSOC);
when I do:
print_r($showAll);
it return an empty array:
array()
Any suggestions please?