tai o meu código se alguem puder me ajjudar a fazer ele exibir invertido eu agradeço..
vlw
<? include"bd.php"; //inclui o arquivo que conecta com bd $sql = "SELECT * FROM tbtorpedo ORDER BY Id DESC LIMIT 1"; $resultado = mysql_query($sql); while($r = mysql_fetch_array($resultado)) { // pega o ultimo registro $total = $r[Id]; } //INICIO echo "<div align='center'>"; if (empty($_GET['pg'])) { $pg="0"; }else{ $pg=$_GET['pg']; } $x=$pg."0"; $y=1; $sinal=0; while($y<=9) { if (($x+$y)>$total) { $y=9; $sinal=1; echo "ultimo"; }else{ //aqui exibe $ql = ("SELECT * FROM tbtorpedo WHERE Id='".$pg.$y."'"); $pesquisa = mysql_fetch_array(mysql_query($ql)); echo $pg.$y; echo "<BR>"; echo $pg; echo "<BR>"; echo $y; echo "<BR>"; echo("<table width='50%' border='0' cellspacing='0' cellpadding='0'> <tr><td><strong><font color='#0000FF'>De: </font></strong><em>".$pesquisa['de']."</em></td> </tr><tr><td><strong><font color='#0000FF'>Para: </font></strong><em>".$pesquisa['para']."</em></td> </tr><tr><td><strong><img src='icones/".$pesquisa['icone'].".gif' width='19' height='19'> ".$pesquisa['mensagem']."</strong></td></tr><tr><td>(enviada ".$pesquisa['data']." - ".$pesquisa['hora']." )</td></tr></table><p></p>"); } $y++; }; ///agora monta os botões de avançar e recuar.. if ($pg==0){ //é a primeira pagina, então naum exibe anterior echo ("<table width='50%' border='0' cellspacing='0' cellpadding='0'><tr><td width='49%'> <div align='center'><strong><em></em></strong> </div></td>"); }else{ print ("<table width='50%' border='0' cellspacing='0' cellpadding='0'><tr><td width='49%'> <div align='center'><strong><em><a href='exibir.php?pg=".($pg-1)."'><font color='#666666'><<Anterior </font></a></em></strong></div></td>"); }; if($sinal==0){ //verifica se é o fim da tebela, caso seja, sinal estará valendo 1 e naum sera necessário exibir próximo echo("<td width='51%'><div align='center'><em><strong><a href='exibir.php?pg=".($pg+1)."'><font color='#666666'>Próxima>></font></a></strong></em></div></td></tr></table><p></p>"); }else{ echo ("<td width='51%'><div align='center'><em><strong></strong></em></div></td></tr></table><p></p>"); }; echo "</div>"; ?>