Bonjour,
J'ai essayé de differente facon d'ajouter votre code et je ni suis pas arrivé.
L'intégrer à un code deja existant s'avérre beaucoup plus compliqué .
Quelqu'un pourait m'aider à l'intégrer ?
Voici le code actuel :
$cat=$_GET['cat'];
$zone=$_POST['zone'];
// Filtre Zone ->
echo "
<form method=\"post\" action=\"\">
<b>$filtre_zone</b> :
<label>
<select name=\"zone\">
";
$query=mysql_db_query($mysql_base,"SELECT * FROM zones ORDER by prix desc",$db);
if (@mysql_num_rows($query)) {
echo "<option value=\"0\"></option>";
while ($row = mysql_fetch_array($query)) {
$id_cat=$row['id'];
$nom_cat=$row['nom'];
echo "<option value=\"$id_cat\" ";if($zone==$id_cat){echo"selected=\"selected\"";}echo">$nom_cat</option>";
}
}
echo "
</select>
</label>
<label>
<input type=\"submit\" name=\"Submit\" value=\"$lien_trier\" />
</label>
</form><br>
";
// <- Fin filtre zone
if ($cat) { $cat="AND cat='$cat'"; }
if ($zone>0) { $zone="AND zone='$zone'"; }
else { $zone=""; }
$query=mysql_db_query($mysql_base,"SELECT * FROM maisons WHERE id<>'' $cat $zone ORDER by prix asc, id desc",$db);
if (@mysql_num_rows($query)) {
echo "
<table width=\"1000\" border=\"0\" align=\"center\" cellspacing=\"0\" cellpadding=\"0\">
<tr>
";
while ($row = mysql_fetch_array($query)) {
$maison_id=$row['id'];
$maison_prix=$row['prix'];
$maison_nom=$row['nom'];
$maison_cat=$row['cat'];
$maison_desc=$row['description'];
$maison_ref=$row['ref'];
$maison_mail=$row['mail'];
$maison_zone=$row['zone'];
$maison_photo=$row['photo'];
$nbimage++;
$queryzone=mysql_db_query($mysql_base,"SELECT nom FROM zones WHERE id='$maison_zone'",$db);
$maison_zone=@mysql_result($queryzone,0,"nom");
$querycat=mysql_db_query($mysql_base,"SELECT nom FROM categories WHERE id='$maison_cat'",$db);
$categorie_nom=@mysql_result($querycat,0,"nom");
if ($categorie_nom != $last_categorie_nom) {
$categorie_affichage="$admin_categorie : <b>$categorie_nom</b>";
$last_categorie_nom=$categorie_nom;
}
else { $categorie_affichage=""; }
echo "
<td align=\"center\" valign=\"middle\">
$maison_prix €
<br>
<a href=\"?inc=view_catalogue&id=$maison_id\"><img src=\"$maison_photo\" border=\"0\"></a>
<br>
<span class=\"minuscule\">Réf. : $maison_ref</span>
<br><br>
</td>
";
if ($nbimage == 3) { echo "</tr><tr>"; $nbimage=0; }
}
echo "</tr>
</table>
";
}
// Si aucune Référence
else { echo "
<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">
<tr>
<td align=\"center\" valign=\"middle\"><br><br> $admin_maison_aucune</td>
</tr></table>
<br><div align=\"center\"><hr></div>
<table width=\"1000\" border=\"0\" align=\"center\" cellpading\"0\" cellspacing=\"0\">
<tr>
</table>
";
}
Et les tables:
Code : Tout sélectionner
CREATE TABLE maisons (
id int(10) NOT NULL auto_increment,
prix text NOT NULL,
nom text NOT NULL,
nomtrad text NOT NULL,
cat int(10) NOT NULL default '0',
description text NOT NULL,
descriptiontrad text NOT NULL,
ref text NOT NULL,
mail text NOT NULL,
pos int(10) NOT NULL default '0',
photo text NOT NULL,
zone int(10) NOT NULL default '0',
KEY id (id)
) TYPE=MyISAM;
P.S : C'est une personne qui ma fait le noyau et je debute en php