php - Selecting multiple rows in a Select statement using PDO -


i have 2 tables, want select first id of salles each responsible (he may have many -> array()) .

so want select salles responsible have, , did statement (which returns empty array , unsure of why):

$sels = $db->prepare("select salle salleresp  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 * salle salleid in ($questionmarks) ");  $selectsalle1->execute($rss);  $showall=$selectsalle1->fetchall(pdo::fetch_assoc); 

when do:

print_r($showall); 

it return empty array:

array() 

any suggestions please?

select * salle salleid in (select salle salleresp  resp = :resp) 

or

select * salle left join salleresp on (salle.salleid = salleresp.salle) resp = :resp) 

Comments

Popular posts from this blog

php - Submit Form Data without Reloading page -

linux - Rails running on virtual machine in Windows -