| 12
 3
 4
 5
 6
 7
 8
 9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 
 | <?php
	
	/*echo "<pre>";
		print_r($_SESSION);
		echo "</pre>";*/
		
//Récupération de la référence de la commande ou l'id du client est egal  à l'id du client actuellement connecté 
		$id_client = $_SESSION['id'];
		$req = $bdd->query('SELECT référence FROM commande WHERE id_client = ' . $id_client. " AND etat = 0 ");
		$refcom = $req->fetchcolumn();
		echo "<p>Ref. commande :" . $refcom . "</p>";
		// $req->closeCursor();
//Récupération de l'id des produit correspondant à la commande en cours de l'utilisateur connecté
	$req = $bdd->prepare('SELECT id_produit, quantite FROM `association-produit-commande` WHERE ref_commande = ? ');
	$req->execute(array($refcom));
	$id_produit = $req->fetchAll();
	
//Récupération de la quantité pour chaque produit
	$req = $bdd->prepare('SELECT quantite FROM `association-produit-commande` WHERE ref_commande = ?');
		$req->execute(array($refcom));
		while ($donnees = $req->fetch())
			
		echo"<p>" .$donnees['quantite'].  "</p>";
	
	
	//echo $donnees['quantite'];
?>	
	<table>
   <tr>
       <th>Produit</th>
       <th>Quantite</th>
   </tr>
   
<?php
	
	foreach($id_produit as $id )
	{
		//print_r($id);
		
		
		$req = $bdd->prepare('SELECT nomCommercial FROM `produit` WHERE id =  ? ');
		$req-> execute(array($id['id_produit']));
		$nom = $req->fetchColumn();
		
		// problème ligne 109 
		
		?>
		
		<tr>
		<td><?php echo $nom; ?></td>					
		<td><?php echo $donnees['quantite']; ?></td> //Mon problème est ici, la variable $donnees['quantité'] n'affiche rien
		</tr>
	
		<?php	
		
		//echo "<p>" .$id['id_produit']. "</p>";
		//echo "<p>" .$nom. "</p>";
		
	}
?>
?> | 
Partager