elle est un peu longue a expliquer. je ne vais pas entrer dans les détails car c'est incomprehensible a l'écrit.
Code : Tout sélectionner
<?php
$link = mysql_connect("localhost","root","");//connexion local
mysql_select_db("bata",$link);//on sélectionne la base mho
$query = "select distinct articles,mag,stock from stock where articles=".$_POST["articles"];
$result = mysql_query($query,$link);//on interroge la base
$html .= "<table width='30%' border='1'><tr>
<td width='20%'><b><font color=red>Articles</font></b></td>
<td width='20%'><b><font color=#FF0000>Magasins</font></b></td>
<td width='20%'><b><font color=#FF0000>Stock</font></b></td>
</tr>";
while ($row = mysql_fetch_array($result)){//tant que qu'il y a un enregistrement on exécute le code
$html .= "<tr>
<td>".$row["articles"]."</td>
<td>".$row["mag"]."</td>
<td>".$row["stock"]."</td>
</tr>";
}
$html .= "</table>";
echo $html; //On affiche la variable $html
mysql_free_result($result);//libération du jeux d'enregistrement
mysql_close($link);//on se déconnecte
?>Ca doit donné :
Code : Tout sélectionner
$query = "select distinct articles,mag,stock from stock where articles=".$_POST["articles"] AND grille.lettre=stock.lettre ;