Suite à un requêtage dans une base, voici le code utilisé pour afficher le résultat (5 news par page)
La 1ère page est OK, les suivantes me proposent le même résultat que la 1ère page. merci de votre aide
Code : Tout sélectionner
$query="SELECT * FROM news ORDER BY date_ins='".$_GET['date_ins']."' DESC , heure_ins='".$_GET['heure_ins']."' DESC";
$res_news = @mysql_query($query,$db);
if (@mysql_num_rows($res_news)!=0)
{
$nb=mysql_num_rows($res_news);
$nbpage=ceil($nb/5);
if (($_GET['page']=="")) {$page=1;}
for ($i=0; $i<$nb; $i=$i+1)
{
$list_news=@mysql_fetch_row($res_news);
if ( ($i>=$list_ordre_news[1]*$page-$list_ordre_news[1]) and ($i<$list_ordre_news[1]*$page)
)
{
echo "<table align='center' width='80%' border='0' cellspacing='2' cellpadding='0' bgcolor='#F7F7F7' class='cadrenews'>";
echo "<tr>";
echo "<td>";
echo "<table width='100%' border='0' cellspacing='0' cellpadding='3'>";
echo "<tr>";
echo "<td width='60%' valign='top' class='textebig'>$list_news[0]</td>";
echo "<td width='40%' align='right' valign='top' class='textedate'>Posté le $list_news[4]<br>à $list_news[5]</td>";
echo "</tr>";
echo "</table>";
echo "<table width='100%'>";
echo "<tr>";
echo "<td width='100%' valign='top' class='textebig' >Url du message : <a href='$list_news[1]' target='_blank'>$list_news[1]</a></td>";
echo "</tr>";
echo "</table><br>";
echo "<table width='100%'>";
echo "<tr>";
echo "<td width='100%' valign='top' class='texte'>"; if ($list_news[3]!="") {echo "<img src='$list_news[3]' width='150' align='left'>";}
echo $list_news[2] . "</td>";
echo "</tr>";
echo "</table><br>";
echo "</td></tr>";
echo "</table><br>";
}
else {}
}
}
echo "<div align='center' class='texte'>Page ";
for ($j=1; $j<=$nbpage; $j++) {
echo "<a href='?page$j=liste' class='lien1'>$j</a> "; }
echo "</div>";