1 pièce(s) jointe(s)
recuperation des données sous forme de liste
Bonjour,
voila j'essais de recuperer à partir de la base des informations que je les metterai sous forme de liste deroulante.
actuellement j'arrive à recuperer la premiere ligne. j'utilise pour ca while mais ca affiche pas le reste.
le sujet concerne un programme de bon de commande.
c'est un formulaire de modification de bon. Un bon de commande peut contenir plusieurs produits. Ce sont ces produits que je voudrais les recuperer et modifier.
voici le code actuel:
Code:
1 2 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
| $req2 = $bdd->prepare("SELECT bondecommande.code_commande, article.des_article, ligne_commande.pu_article, ligne_commande.qty_cde FROM ligne_commande
INNER JOIN bondecommande ON ligne_commande.num_commande = bondecommande.Num_commande
INNER JOIN article ON ligne_commande.num_article = article.num_article
WHERE bondecommande.code_commande = :code_BC");
$req2->bindParam(":code_BC",$bc);
$req2->execute();
$req3 = $bdd->prepare('SELECT des_article FROM article ORDER BY des_article');
$req3->execute() or die(print_r($reqq->errorInfo()));
<table class="dTable">
<thead>
<tr>
<th><div align="center">Code article</div></th>
<th><div align="center">Qty à commander</div></th>
<th><div align="center">Prix unitaire</div></th>
<th></th>
</tr>
</thead>
<tfoot>
<th><input type="button" value="retour" onClick="document.location.href = document.referrer" /></th>
<th><input type="submit" name="valider" value= "Valider" /></th>
<th><input type="submit" name="rejeter" value= "Rejeter" /></th>
</tfoot>
<tbody>
<?php
while($datas=$req2->fetch())
{
//var_dump($datas[1]);
?>
<tr>
<td><select name='des_article' ><?php while ($datas3=$req3->fetch()) {?><option value="<?php echo $datas3[0]; ?>" <?php echo $datas[1]==$datas3[0] ? ' SELECTED ' : '' ; ?>><?php echo htmlentities($datas3[0]); ?></option><?php } ;$req3->closeCursor();?></select></td>
<td><input type="text" name="qty_article" value="<?php echo $datas[3] ;?> "/></td>
<td><input type="text" name="pu_article" value="<?php echo $datas[2]; ?> "/></td>
</tr><?php
}
$req2->closeCursor();
?>
</tbody>
</table> |
le problème en image:
Pièce jointe 149854
A vous.