Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 97EC2475E51 for ; Fri, 23 Aug 2002 10:38:31 -0400 (EDT) Received: from secure.pghoster.com (unknown [64.246.32.44]) by postgresql.org (Postfix) with ESMTP id 09548475DFF for ; Fri, 23 Aug 2002 10:38:31 -0400 (EDT) Received: from pghoster.com (12-239-88-3.client.attbi.com [12.239.88.3]) (authenticated (0 bits)) by secure.pghoster.com (8.11.6/8.11.6) with ESMTP id g7NFaxB10910; Fri, 23 Aug 2002 10:36:59 -0500 Message-ID: <3D66485A.40803@pghoster.com> Date: Fri, 23 Aug 2002 09:36:10 -0500 From: Roj Niyogi User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.1b) Gecko/20020819 X-Accept-Language: en-us, en MIME-Version: 1.0 To: angelo.rigo@globo.com Cc: pgsql-php@postgresql.org Subject: Re: next and previous links References: <3D3EEC5F000A085E@riosf05.globoi.com> Content-Type: text/plain; charset=ISO-8859-15; format=flowed Content-Transfer-Encoding: 8bit X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200208/79 X-Sequence-Number: 1424 My obvious first question is whether $limite is getting a value. If not, it'll think no parameters are being passed. Roj pgHoster.com - PostgreSQL Web Hosting http://www.pghoster.com angelo.rigo@globo.com wrote: >Hi >i am trying to make this code below to work >at least i do get a right pagination, going away and coming back with the >links, but no data is displayed > >the browser says this lines has a wrong count parameter > >while ($dados = pg_fetch_array($limite)) { > >this line is followed by these > $nome = $dados["nome"]; > echo "Nome: $nome
"; >} > >thank?s in advance ! >$conn = pg_connect("dbname=anyname user=anyuser"); >$busca = "SELECT nome FROM aprovados order by nome asc"; >$total_reg = "20"; // número de registros por página > >if (!$pagina) { > $pc = "1"; >} else { > $pc = $pagina; >} > >$inicio = $pc - 1; >$inicio = $inicio * $total_reg; > >$limite = pg_exec("$busca LIMIT $inicio,$total_reg"); >$todos = pg_exec("$busca"); > >$tr = pg_numrows($todos); // verifica o número total de registros >$tp = $tr / $total_reg; // verifica o número total de páginas > >while ($dados = pg_fetch_array($limite)) { // vamos criar a visualização > > $nome = $dados["nome"]; > echo "Nome: $nome
"; >} > >$anterior = $pc -1; // agora vamos criar os botões "Anterior e próximo" >$proximo = $pc +1; >if ($pc>1) { > echo " <- Anterior "; >} >echo "|"; >if ($pc<$tp) { > echo " Próxima ->"; >} >?> > >________________________________________ >A busca mais veloz e precisa da internet. Acesse agora: http://www.zoom.com.br. > > > >---------------------------(end of broadcast)--------------------------- >TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org > >