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
| <?php
$famille = "";
if (isset($_GET['famille']) && !empty($_GET['famille'])) {
// Ici il faudrait peut-être ajouter des tests supplémentaires avec un switch() par exemple
$famille = " WHERE categorie = '".mysql_real_escape_string($_GET['famille'])."'";
}
$query="SELECT * FROM produits $famille"; // De cette façon si le $_GET['famille'] reçu n'est pas correct ou meme pas transmis, on affiche tous les produits
$result=mysql_query($query);
if (mysql_num_rows($result) > 0) {
echo" ";
echo "<table width='80%' border='1' class='tab_fam'>";
echo"<tr class='col'><td>Dimension</td>
<td>Modele</td>
<td>Marque</td>";
if(isset($_SESSION["login"]))
{ echo"<td>P.V.H.T </td>
<td>P.V.TTC </td>";}
echo"</tr>";
while($ligne=mysql_fetch_array($result))
{$i=0;
echo"<tr><td><a href=\"javascript:void(0)\"; onClick=\"window.open('detail_pneu.php?id_pneu=$ligne[0]','_blank','menubar=no,location=no,directories=no,status=no,copyhistory=no,height=500,width=700,toolbar=no,scrollbars=yes,resizable=no');\" />
$ligne[1]</td>
<td>$ligne[2]</td>
<td>$ligne[3]</td>";
if(isset($_SESSION["login"])){
echo"<td>$ligne[4]</td>
<td>$ligne[5]</td>";}
echo "</tr>";
$i++;}
echo"</table>";
} else {
if (isset($_GET['famille']) && !empty($_GET['famille'])) {
echo "<p>Il n'y a aucun produit à afficher pour ".$_GET['famille']."</p>";
} else {
echo "<p>Il n'y a aucun produit à afficher</p>";
}
} |