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
|
<?php
if(!empty($_POST['choixcategories'])){$choixcategories=$_POST['choixcategories'];}else{$choixcategories = $_SESSION['choixcategories'];}
$_SESSION['choixcategories']=$choixcategories;
if(!empty($_POST['regions'])){$regions=$_POST['regions'];}else{$regions = $_SESSION['regions'];}
$_SESSION['regions']=$regions ;
if($regions== "Toute la France" )
{switch($choixcategories)
{case "auto" :
case "camion":
case "utilitaire":
$p=0;
$reponse1=$bdd->query('select * from annonces as APR inner join coordonnees as CPR on APR.id_client=CPR.id_client and APR.typeannonce="offre" where APR.cat="'.$choixcategories.'" order by date desc ' );
while($donnes =$reponse1-> fetch())
{if (preg_match("#".$zone_sasie."#i" ,$donnes['titre'] )|| preg_match("#".$zone_sasie."#i" ,$donnes['texte'])) {$p=$p+1;}}
$nbre_total = $p;
//echo $nbre_total;
$nbre_de_page = ceil($nbre_total / $nbre_par_page);
if (isset($_GET['page'])){$page = $_GET['page'];}else{$page = 1;}
$premier_page = ($page - 1) * $nbre_par_page;
$reponse1=$bdd->query('select * from annonces as APR inner join coordonnees as CPR on APR.id_client=CPR.id_client and APR.typeannonce="offre" where APR.cat="'.$choixcategories.'" order by date desc limit '.$premier_page.','.$nbre_par_page.'');
while($donnes =$reponse1-> fetch())
{
{?>
<div id="affichage">
<span> mise en ligne le : <?php echo $donnes['date'];?> </span>
<div id="titre"><strong><?php echo '<a href="annonce.php?offre='.$donnes['id_client'].'">'.$donnes['titre'].'</a>'.'</br></br>';?></strong></div>
<table id="tab1">
<tr>
<td><?php if($donnes['photo1']!= "0"){echo '<img src="'.$donnes['photo1'].' "width="150" height="100" >';}?></td>
<td><strong><?php echo $donnes['nom'];?></strong></td>
<td><strong><?php echo $donnes['type'];?></strong></td>
<td><strong><?php echo $donnes['cp'];?></strong></td>
<td><strong><?php if($donnes['prix']!=0){ echo ''.$donnes['prix']. ' ';}?></strong></td>
</table>
</tr>
<hr size=2 width=100% align=left >
</div>
<?php
}
}?>
<div id="pagination">
<?php
if ($page > 1){ echo '<a href="resultat_recherche.php?page='.($page-1).'">Precedent</a>' ;}else{echo "Precedent";}
for ($i = 1 ; $i <= $nbre_de_page ; $i++){ echo '<a href="resultat_recherche.php? page=' . $i . '">' . $i . '</a> ';}
if ($page < $nbre_de_page){echo '<a href="resultat_recherche.php? page='.($page+1).'">Suivant</a>';}else{echo "Suivant";}
?>
</div>
<?php
$reponse1->closecursor();
break;
}
}
</body>
</html> |
Partager