_SDinfo 3 Denunciar post Postado Setembro 11, 2012 O código abaixo funciona muito bem, o problema é que o menu de navegação sempre é impresso no topo da página (antes da tabela), como imprimir este depois da tabela? <?php require_once('includes/inicia_sessao.php'); require_once('includes/proteger.php'); require_once('db_connect.php'); ?> <html> <head> <title>Lista de alertas</title> <link href="css/bootstrap.css" rel="stylesheet" /> </head> <body> <table class="tabela_contador tabela_contador-striped tabela_contador-bordered"> <tr> <th>Alertas</th> <th>Ambiente</th> <th>Data/Hora</th> <th>Por</th> <th>descrição</th> </tr> <? function lista_de_alertas($inicio,$maximo) { foreach(ver('tab_alerta', 'id, alerta, ambiente, data_hora, descricao, usuario', '', '', '', "$inicio,$maximo") as $valor) { echo "<tr>"; echo "<td><center><a href='alerta.php?id=" . $valor['id'] . "'>{$valor['alerta']}</a></center><br />"; echo "<td><center><a href='alerta.php?id=" . $valor['id'] . "'>{$valor['ambiente']}</a></center><br />"; echo "<td><center><a href='alerta.php?id=" . $valor['id'] . "'>{$valor['data_hora']}</a></center><br />"; echo "<td><center><a href='alerta.php?id=" . $valor['id'] . "'>{$valor['usuario']}</a></center><br />"; echo "<td>" . encurtar($valor['descricao']) . "<br /><br />"; echo "</tr>"; } } function contar_alertas() { foreach($resultados = ver('tab_alerta', 'id') as $valor) { return $resultados; } } $maximo = 10; $total = count(contar_alertas()); $pgs = ceil($total / $maximo); if($total == 0) { echo "Nehum registro encontrado.<br />"; exit(); } elseif(isset($_GET['pag'])) { $pag = $_GET['pag']; if(!is_numeric($pag) || $pag > $pgs){ echo "Um valor inválido de página foi informado!"; exit(); } } else { $pag = 1; } $inicio = $pag - 1; $inicio = $maximo * $inicio; if($total > $maximo) { lista_de_alertas($inicio,$maximo); } else { lista_de_alertas($inicio,$total); } $menos = $pag - 1; $mais = $pag + 1; if($pgs > 1 ) { if($menos > 0) { echo "<a href=\"?pag=$menos\" >« anterior</a> "; } else { echo "« anterior "; } for($i=1;$i <= $pgs;$i++) { if($i != $pag) { echo " <a href=\"?pag=".($i)."\" >[$i]</a> "; } else { echo " <strong>[".$i."]</strong> "; } } if($mais <= $pgs) { echo " <a href=\"?pag=$mais\" > próxima »</a> "; } else { echo " próxima »"; } } @mysql_close($conectar_db); ?> </body> </html> Resolvido. Tinha esquecido de fechar a tag </table> no final da função. Compartilhar este post Link para o post Compartilhar em outros sites