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
| <?php
$_GET['pgDest'];
$_GET['pn'];
include 'bdd/connexion.php';
/*$sql = "select COUNT(id) from annonces where region = '".$_GET['pgDest']."'";
$query = mysql_query($sql) or die ('Erreur SQL <br>' .$sql. '<br>' .mysql_error());
$row = mysql_fetch_row($query);
$rows = $row[0];*/
$page_rows = 10;
$last = 10;//ceil($rows/$page_rows);
if ($last < 1)
{
$last = 1;
}
$pagenum = 1;
if (isset($_GET['pn']))
{
$pagenum = preg_replace('#[^0-9#', '', $_GET['pn']);
}
if ($pagenum < 1)
{
$pagenum = 1;
}
else if ($pagenum > $last)
{
$pagenum = $last;
}
$limit = 'LIMIT '.($pagenum - 1) * $page_rows .',' .$page_rows;
$dest=$_GET['pgDest'];
if ($dest == 'likouala')
{
$sql = "SELECT * FROM annonces WHERE region='$dest' ORDER BY dannonce DESC $limit";
$req = mysql_query($sql) or die ('Erreur SQL <br>' .$sql. '<br>' .mysql_error());
$num = mysql_fetch_row($req);
if ($num=0)
{
echo "<!DOCTYPE html >
<head>
<meta http-equiv='Content-Type' content='text/html; charset=UTF-8' />
<meta name='description=' content='Postez ici gratuitement toutes vos annonces. Nous vous donnons la possibilité de faire de bonnes affaires
à moindres coûts' />
<title>Kota Tala Somba - Postez votre annonce gratuitement</title>
<link rel='stylesheet' type='text/css' href='styles/forme.css' />
</head>
<body>
<div id='corps'>";
include 'fichiers/mutu.html';
include 'fichiers/menu_g.html';
include 'fichiers/recherche.html';
echo "<p style='margin:auto; font-weight:bold; color:#F90; text-align:center; margin-bottom:20px;'>Aucune information disponible pour cette recherche. Veuillez entrer un autre critère</p>";
include 'fichiers/footer.html';
echo "</div>";
echo "</body></html>";
}
else
{
//$textline1 = "Annonces (<b>$total_annonces</b>)";
//$textline2 = "Page <b>$pagenum</b> of <b>$nbre_pages</b>";
$paginationCtrls = '';
if ($last != 1)
{
if ($pagenum > 1) //si pagenum = 1 le lien precedent n'apparait pas
{
$precedent = $pagenum - 1;
$paginationCtrls .= '<a href="'.$_SERVER['PHP_SELF'].'?pgDest='.$dest.'&pn='.$precedent.'">Précédent</a> ';
for ($i = $pagenum - 4; $i < $pagenum; $i++)
{
if ($i > 0)
{
$paginationCtrls .= '<a hhref="'.$_SERVER['PHP_SELF'].'?pgDest='.$dest.'&pn='.$i.'">' .$i. '</a> ';
}
}
}
$paginationCtrls .= ''.$pagenum.' ';
for ($i = $pagenum + 1; $i <= $last; $i++)
{
$paginationCtrls .= '<a href="'.$_SERVER['PHP_SELF'].'?pgDest='.$dest.'&pn='.$i.'">' .$i. '</a> ';
if ($i >= $pagenum + 4)
{
break;
}
}
if ($pagenum != $last)
{
$suivant = $pagenum + 1;
$paginationCtrls .= '<a href="'.$_SERVER['PHP_SELF'].'?pgDest='.$dest.'&pn='.$suivant.'">Suivant</a> ';
}
}
$list = '';
while ($row = mysql_fetch_array($req, MYSQLI_ASSOC))
{
$id = $row['id'];
$dannonce = $row['dannonce'];
$chemin = "<a class='vignette' href='detail.php?id=".$row['id']."'><img src='" .$row['chemin']. "' width='150px' height='100px' /></a>";
$titre = $row['titre'];
$description = substr($row['description']. '...',0,150);
$prix = $row['prix']. 'FCFA';
$tvendeur = $row['tvendeur'];
$list .= "<table>
<tr>
<td width='100px'>" .$dannonce. "</td>
<td>" .$chemin. "</td>
<td width='160px'>" .$titre. "</td>
<td width = '250px'>" .$description. "</td>
<td width='150px'>" .$prix. "</td>
<td width='120px'>" .$tvendeur. "</td>
</tr>
</table>";
}
}
}
mysql_close();
?>
<!DOCTYPE html >
<head>
<meta http-equiv='Content-Type' content='text/html; charset=UTF-8' />
<meta name='description=' content='Postez ici gratuitement toutes vos annonces. Nous vous donnons la possibilité de faire de bonnes affaires
à moindres coûts' />
<title>Kota Tala Somba - Postez votre annonce gratuitement</title>
<link rel='stylesheet' type='text/css' href='styles/forme.css' />
</head>
<body>
<div id="corps">
<?php
include 'fichiers/mutu.html';
include 'fichiers/menu_g.html';
include 'fichiers/recherche.html';
?>
<?php echo $list; ?>
<h4><?php echo $paginationCtrls; ?></h4>
<?php include 'fichiers/footer.html'; ?>
</div>
</body>
</html> |
Partager