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 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144
| <?php
require_once("../connexion/connexion.php");
$mot=$_GET['searchwordPrd'];
?>
<form method="post" action="rechercherProduit.php">
<table class="contentpaneopen">
<tr>
<td nowrap="nowrap">
<label for="search_searchword">
Rechercher des produits :
</label>
</td>
<td nowrap="nowrap">
<input type="text" name="searchwordPrd" id="search_searchwordPrd" size="30" maxlength="20" value="<?php echo $mot; ?>" class="inputbox" />
</td>
<td width="100%" nowrap="nowrap">
<button name="Search" onclick="this.form.submit()" class="button">Recherche</button>
</td>
</tr>
<tr>
<td colspan="3">
<label for="ordering">
Rechercher des produits par categorie:
</label>
<select name="categorie" id="menucategorie">
<?php
$resultat=mysql_query("select categorie from Categorie order by categorie") or die ("requète non executé");
if (! $resultat) { echo "Erreur requete"; exit;}
while ($ligne=mysql_fetch_array($resultat))
{
?>
<option><?php echo ''.$ligne['categorie'].'';?> </option>
<?php
}
$_GET['cat']=$ligne["categorie"];
$cat=$_GET['Cat'];
$res2=mysql_query("SELECT SousCategorie.nomSC
FROM SousCategorie, Categorie
where Categorie.numCat = SousCategorie.numCat
and Categorie.categorie =".$cat) or die ("Requête non executée.");
if (! $res2) { echo "Erreur requete"; exit;}
while ($ligne2=mysql_fetch_array($res2))
{
?>
<option><?php echo ''.$ligne2['nomSC'].'';?> </option>
<?php
}
mysql_close();
?>
</select>
</td>
</tr>
</table>
</table>
</form>
--------------------------------------------------
<?php
require_once("../connexion/connexion.php");
$mot=$_POST['searchwordPrd'];
if (($mot == "")||($mot == "%")) {
// Si aucun mot clé n'a été saisi,
// le script demande à l'utilisateur
// de bien vouloir préciser un mot clé
echo "
Veuillez entrer un mot clé s'il vous plaît!
<p>";
}
else{
$res=mysql_query("SELECT Produit.libPrd , Societe.raisonSociale ,SousCategorie.nomSC , Categorie.categorie , Marque.marque
FROM Produit, Societe, SousCategorie, Categorie, Marque
WHERE Societe.numSociete = Produit.numSociete
AND SousCategorie.numSC = Produit.numSC
AND Categorie.numCat = SousCategorie.numCat
AND Marque.numMarque = Produit.numMarque
AND
( Produit.libPrd like \"%$mot%\"
or Societe.raisonSociale like \"%$mot%\"
or SousCategorie.nomSC like \"%$mot%\"
or Categorie.categorie like \"%$mot%\"
or Marque.marque like \"%$mot%\")
");
echo mysql_error();
if(mysql_num_rows($res)>=1){
echo"<table border=2>";
echo"<tr>";
echo"<td>produit</td>";
echo"<td>societe</td>";
echo"<td>Sous Categorie</td>";
echo"<td>Categorie</td>";
echo"<td>marque</td>";
echo"</tr>";
echo"<tr>";
while($m=mysql_fetch_array($res))
{
echo "<tr>","<td>",$m[0],"</td>","<td>",$m[1],"</td>","<td>",$m[2],"</td>","<td>",$m[3],"</td>","<td>",$m[4],"<td>","</tr>","<br>";
}
//mysql_query($req,$c);
mysql_close();
echo"</tr>";
echo"</table>";
}
else{
echo "0 Resultat";
}
}
?> |
Partager