Voilà je suis en plein test, mais il ne m'affiche rien, uniquement ceci :
	
		
			
			
				Notice: Undefined variable: data in C:\Program Files (x86)\EasyPHP-DevServer-14.1VC9\data\localweb\vsdm\test.php on line 17
Warning: Invalid argument supplied for foreach() in C:\Program Files (x86)\EasyPHP-DevServer-14.1VC9\data\localweb\vsdm\test.php on line 17
			
		
 
	 
 pour cette ligne
	
	foreach($data as $materiel=>$numbers) {
 Merci pour l'aide
Voici le code :
	
	| 12
 3
 4
 5
 6
 7
 8
 9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 
 | <?php
try
{
	$bdd = new PDO('mysql:host=localhost;dbname=test;charset=utf8', 'root', '');
}
catch(Exception $e)
{
        die('Erreur : '.$e->getMessage());
}
 
$sth = $bdd->prepare("SELECT * FROM test where localisation='test1'");
 
while ($row = $sth->fetch(PDO::FETCH_ASSOC)) {
   $data[$row['materiel']][] = $row['sn'];
}
 
 
foreach($data as $materiel=>$numbers) {
   echo count($numbers) . ' ' . $materiel . '<br/>';
   foreach($numbers as $sn) {
      echo $sn . '<br/>';
   }
}
 
?> | 
 
						
					
Partager