Problemas com while e tabelas
Salve galera estou com um probleminha aqui com um while quer dizer o whiles esta funcionando so que fiz um paginaçao que deveria exibir 21 registros por pagina
sendo mais ou menis assim
01 02 03 04 05 06 07
08 09 10 11 12 13 14
15 16 17 18 19 20 21
mas ele esta me retornado
1234567899101112131415161718192021
esse eh o meu problema so a organizaçao dos dados obtidos pelo while abaixo o cod
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="[http://www.w3.org/1999/xhtml">](http://www.w3.org/1999/xhtml)
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
<style type="text/css"><!--
body {
margin-left: 0px;
margin-top: 0px;
margin-right: 0px;
margin-bottom: 0px;
}
.style2 {
font-family: Geneva, Arial, Helvetica, sans-serif;
font-size: 16px;
color: #006699;
font-weight: bold;
}-->
</style></head>
<body>
<?php
include("conexao.php");//######### INICIO Paginação
$numreg = 21; // Quantos registros por página vai ser mostrado
if (!isset($pg)) {
$pg = 0;
}
$inicial = $pg * $numreg;
//######### FIM dados Paginação
// Faz o Select pegando o registro inicial até a quantidade de registros para página
$sql =("SELECT id,nome FROM lancamentos ORDER BY id DESC LIMIT $inicial,$numreg");
$dados = mysql_query("$sql");
// Serve para contar quantos registros você tem na seua tabela para fazer a paginação
$sql_conta = mysql_query("SELECT nome FROM lancamentos ORDER BY id DESC");
// Quantidade de registros pra paginação
@$quantreg = mysql_num_rows($sql_conta);
while($aux= mysql_fetch_array($dados))
{
@$id= $aux["id"];
print "<td width='103'><img width='90' height='87' src='cad_lanc/fotos/$id.jpg'/></td> ";
}
?>
</body>
</html>Discussão (5)
Carregando comentários...