pg.ddx.io  pgsql-php@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: scott.marlowe <scott.marlowe@ihs.com>
To: angelo.rigo@globo.com
Cc: pgsql-php@postgresql.org
Subject: Re: pg_fetch_array problem
Date: Thu, 8 Aug 2002 11:03:38 -0600 (MDT)
Message-ID: <Pine.LNX.4.33.0208081102090.24001-100000@css120.ihs.com> (raw)
In-Reply-To: <3D3EEC5F00049E81@riosf05.globoi.com>

What version of PHP are you running?  The autoincrementing nature of the 
row value in pg_fetch_array wasn't included until PHP 4.1.0

On Thu, 8 Aug 2002 angelo.rigo@globo.com wrote:

> Hi i am trying to build
> previous and next links from a table selection, the code below stops working
> at the line which says :
> 
> while ($dados = pg_fetch_array($limite)) {
>     $nome = $dados["nome"];
>     echo "Nome: $nome<br>";
> 
> the warning says:
> Wrong parameter count for pg_fetch_array()
> 
> i get this code from a php mysql and try to adapt to my needs, is that any
> parameter wrong? wich can be?
> 
> 
> <?php
> 
> $conn = pg_connect("dbname=sondagem user=postgres");
> ?>
> <?php
> $busca = "SELECT nome AS data FROM aprovados ORDER BY nome ASC ";
> ?>
> <?php
> $total_reg = "10"; // número de registros por página
> ?>
> <?php
> if (!$pagina) {
>     $pc = "1";
> } else {
>     $pc = $pagina;
> }
> ?>
> <?php
> $inicio = $pc - 1;
> $inicio = $inicio * $total_reg;
> ?>
> <?php
> $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
> 
> // vamos criar a visualização
> while ($dados = pg_fetch_array($limite)) {
>     $nome = $dados["nome"];
>     echo "Nome: $nome<br>";
> }
> 
> // agora vamos criar os botões "Anterior e próximo"
> $anterior = $pc -1;
> $proximo = $pc +1;
> if ($pc>1) {
>     echo " <a href='?pagina=$anterior'><- Anterior</a> ";
> }
> echo "|";
> if ($pc<$tp) {
>     echo " <a href='?pagina=$proximo'>Próxima -></a>";
> }
> ?>
> 
> ________________________________________
> A busca mais veloz e precisa da internet. Acesse agora: http://www.zoom.com.br.
> 
> 
> 
> ---------------------------(end of broadcast)---------------------------
> TIP 4: Don't 'kill -9' the postmaster
> 




view thread (4+ messages)  latest in thread

Message-ID: <Pine.LNX.4.33.0208081102090.24001-100000@css120.ihs.com>
Permalink:  ../Pine.LNX.4.33.0208081102090.24001-100000@css120.ihs.com/
Also on:    postgresql.org/message-id/Pine.LNX.4.33.0208081102090.24001-100000@css120.ihs.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-php@postgresql.org
  Cc: scott.marlowe@ihs.com, angelo.rigo@globo.com
  Subject: Re: pg_fetch_array problem
  In-Reply-To: <Pine.LNX.4.33.0208081102090.24001-100000@css120.ihs.com>
  References: <3D3EEC5F00049E81@riosf05.globoi.com> <Pine.LNX.4.33.0208081102090.24001-100000@css120.ihs.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox