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
| $perPage = 4;
$cPage = 1 ;
// Requette pour le moteur de recherche
$query = ("SELECT * From annonce
LEFT JOIN type_annonce ON annonce.type_annonce = type_annonce.id
LEFT JOIN type_annonceur ON annonce.vous_etes = type_annonceur.id
LEFT JOIN categorie ON annonce.id_categorie = categorie.id
LEFT JOIN villes ON annonce.id_ville = villes.id
LEFT JOIN departement ON villes.departement = departement.code
LEFT JOIN region ON departement.id_region = region.id_region
WHERE activer_annonce=1 ");
$f=explode(',', $_GET['area']);
foreach($f as $fe)
if (isset($_GET['area']) != ""){ $query .= " AND region.id_region LIKE '%$fe%'"; }
$q=explode(',', $_GET['dep']);
foreach($q as $depart)
if (isset($_GET['area']) != ""){ $query .= " AND code LIKE '%$depart%'"; }
$s=explode(" ",$t);
foreach($s as $mot)
if ($mot != ""){ $query .= " and titre_annonce LIKE '%$mot%' "; }
if (isset($_GET['a']) != ""){ $query .= " AND vous_etes LIKE '%$a%'"; }
$z=explode(" ",$c);
foreach($z as $all)
if (isset($_GET['c']) != ""){ $query .= " AND id_categorie LIKE '%$c%'"; }
$e=explode(" ",$cp);
foreach($e as $code_postal)
if (isset($_GET['cp']) != ""){ $query .= " AND villes.code_postal LIKE '%$code_postal'"; }
if (isset($_GET['offres']) != ""){ $query .= " AND type_annonce LIKE '$type'"; }
$query .= " ORDER BY id_annonce DESC LIMIT ".(($cPage-1)/$perPage)." ,$perPage";
$result1 = mysql_query($query, $cnx);
$nb_resultats1 = mysql_num_rows($result1);
$nbPage = $nb_resultats1/$perPage;
echo $nbPage; |