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 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162
|
<?php
/******************************************************************
* REFERENCE AUX DEFINITIONS DE CONSTANTES POUR MYSQL
******************************************************************/
include('connect.php');
//=========================================
// initialisation des variables
//=========================================
// on va afficher 5 résultats par page.
$nombre = 5;
if (!isset($limite)) $limite = 0; // si on arrive sur la page pour la première fois
// on met limite à 0.
$path_parts = pathinfo($_SERVER['PHP_SELF']);
$page = $path_parts['basename'];
//=========================================
// requête SQL qui compte le nombre total
// d'enregistrements dans la table.
//=========================================
$select = 'SELECT count(Identifiant) FROM Agence_immobiliere';
$result = mysql_query($select,$bd) or die ('Erreur : '.mysql_error() );
$row = mysql_fetch_row($result);
$total = $row[0];
//=========================================
// vérifier la validité de notre variable
// $limite;
//=========================================
$verifLimite= verifLimite($limite,$total,$nombre);
// si la limite passée n'est pas valide on la remet à zéro
if(!$verifLimite) {
$limite = 0;
}
//=========================================
// requête SQL qui ne prend que le nombre
// d'enregistrement necessaire à l'affichage.
//=========================================
if(isset($_POST['toutescommunes']))
{
$choix1 = $_POST[''];
}
else
{
$choix1 = $_POST['communes'];
}
if(isset($_POST['tousbiens']))
{
$choix2 = $_POST[''];
}
else
{
$choix2 = $_POST['biens'];
}
if(isset($_POST['tousprix']))
{
$choix3 = $_POST[''];
}
else
{
$choix3 = $_POST['prix'];
}
if(isset($_POST['toutespieces']))
{
$choix4 = $_POST[''];
}
else
{
$choix4 = $_POST['pieces'];
}
$choix1 != "";
$choix2 != "";
$choix3 != "";
$choix4 != "";
$finrequete = "(Nom_commune LIKE '%$choix1%' AND Type_bien LIKE '%$choix2%' AND Fourchette_prix LIKE '%$choix3%' AND Nombre_pieces LIKE '%$choix4%')";
$select = 'select Nom_commune,Type_bien, Nombre_pieces, Dimension, Prix, Descriptif, Image1, Image2, Image3, Image4, Image5, Image6 FROM Agence_immobiliere ORDER BY Identifiant ASC limit '.$limite.','.$nombre;
$result = mysql_query($select,$link) or die ('Erreur : '.mysql_error() );
//=========================================
// si on a récupéré un resultat on l'affiche.
//=========================================
if($total) {
echo "<H4 >Résultats de votre recherche pour ce type de bien :</H3>";
do {
echo "<table>";
echo "<td>".$maligne['Nom_commune']."</td>";
echo "<td>".$maligne['Type_bien']."</td>";
echo "<td>".$maligne['Nombre_pieces']."</td>";
echo "<td>".$maligne['Dimension']."</td>";
echo "<td>".$maligne['Prix']."</td>";
echo "<td>".$maligne['Descriptif']."</td>";
echo "<td><img src=/scripts/timthumb.php?src=Imagesagence/".$maligne['Image1']."&h=150&w=YY&zc=1 /></td>";
echo "<td><img src=/scripts/timthumb.php?src=Imagesagence/".$maligne['Image2']."&h=150&w=YY&zc=1 /></td>";
echo "<td><img src=/scripts/timthumb.php?src=Imagesagence/".$maligne['Image3']."&h=150&w=YY&zc=1 /></td>";
echo "<td><img src=/scripts/timthumb.php?src=Imagesagence/".$maligne['Image4']."&h=150&w=YY&zc=1 /></td>";
echo "<td>><img src=/scripts/timthumb.php?src=Imagesagence/".$maligne['Image5']."&h=150&w=YY&zc=1 /></td>";
echo "<td><img src=/scripts/timthumb.php?src=Imagesagence/".$maligne['Image6']."&h=150&w=YY&zc=1 /></td>";
echo "</table><br>";
}while ($maligne=mysql_fetch_array($resultat));
}
else {
echo "Aucun bien pour ce type de recherche!";
}
mysql_free_result($result);
//=========================================
// si le nombre d'enregistrement à afficher
// est plus grand que $nombre
//=========================================
if($total > $nombre) {
// affichage des liens vers les pages
affichePages($nombre,$page,$total);
// affichage des boutons
displayNextPreviousButtons($limite,$total,$nombre,$page);
}
?> |
Partager