Bonjour,

j'essaye de lire une table avec PDO, mais visiblement, on entre pas dans le foreach que je fais ; pourquoi ?

Code php : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
<?php    ...
try {
	$connexion=connect();
 
	$sql = 'SELECT nom FROM `patient`;';
?>
 
 
<form	method="post" action="">
<select name="nom_patient" onChange="this.parentNode.submit()">
<?php
	echo '<option value="">Veuillez sélectionner le nom du patient</option>';
   foreach (($connexion->query($sql)) as $row) {
   $nom_patient="test";
 echo( $nom_patient);
 
		}
 
?>
</select>
</form>