next and previous links

next and previous links

am 23.08.2002 16:34:54 von angelo.rigo

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 =3D pg_fetch_array($limite)) {

this line is followed by these
$nome =3D $dados["nome"];
echo "Nome: $nome
";
}

thank?s in advance !
$conn =3D pg_connect("dbname=3Danyname user=3Danyuser");
$busca =3D "SELECT nome FROM aprovados order by nome asc";
$total_reg =3D "20"; // n=FAmero de registros por p=E1gina

if (!$pagina) {
$pc =3D "1";
} else {
$pc =3D $pagina;
}

$inicio =3D $pc - 1;
$inicio =3D $inicio * $total_reg;

$limite =3D pg_exec("$busca LIMIT $inicio,$total_reg");
$todos =3D pg_exec("$busca");

$tr =3D pg_numrows($todos); // verifica o n=FAmero total de registros
$tp =3D $tr / $total_reg; // verifica o n=FAmero total de p=E1ginas

while ($dados =3D pg_fetch_array($limite)) { // vamos criar a visualiza=E7=
=E3o

$nome =3D $dados["nome"];
echo "Nome: $nome
";
}

$anterior =3D $pc -1; // agora vamos criar os bot=F5es "Anterior e pr=F3xim=
o"
$proximo =3D $pc +1;
if ($pc>1) {
echo " ";
}
echo "|";
if ($pc<$tp) {
echo " ";
}
?>

________________________________________
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

Re: next and previous links

am 23.08.2002 16:36:10 von Roj Niyogi

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 " ";
>}
>echo "|";
>if ($pc<$tp) {
> echo " ";
>}
>?>
>
>________________________________________
>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
>
>


---------------------------(end of broadcast)---------------------------
TIP 2: you can get off all lists at once with the unregister command
(send "unregister YourEmailAddressHere" to majordomo@postgresql.org)