Paginating results
Paginating results
От:
Ângelo Marcos Rigo <angelo_rigo@yahoo.com.br>
Дата:
Hi
I am trying to write a script to paginate results
the problem is that this script just return something
after the second page the first do not return nothing.
The other problem is that the script just add the next
set of results at the end of the old set of results,
instead of paginate to them.
";
}
// Figure out the total number of results in DB:
$total_results = pg_result(pg_query("SELECT COUNT(*)
as Num FROM paginar"),0);
// Figure out the total number of pages. Always round
up using ceil()
$total_pages = ceil($total_results / $max_results);
// Build Page Number Hyperlinks
echo "Selecione uma página
";
// Build Previous Link
if($page > 1){
$prev = ($page - 1);
echo "< ";
}
for($i = 1; $i <= $total_pages; $i++){
if(($page) == $i){
echo "$i ";
} else {
echo "$i ";
}
}
// Build Next Link
if($page < $total_pages){
$next = ($page + 1);
echo "Next>>";
}
echo "";
?>
=====
Ângelo Marcos Rigo
AMR Informática
(51) 3348 0870
Rua Pe. Alois Kades 400/210
Porto Alegre /RS/Brasil
http://amr.freezope.org
angelo_rigo@yahoo.com.br
_______________________________________________________________________
Yahoo! Mail
Mais espaço, mais segurança e gratuito: caixa postal de 6MB, antivírus, proteção contra spam.
http://br.mail.yahoo.com/