0
Good evening, I need a pagination made on PHP and Postgresql, I searched the internet but found nothing useful, I tried to apply a PHP/Mysql code but the result was negative.
The code I used:
if (isset($_GET["page"])) { $page = $_GET["page"]; } else { $page=1; };
$start_from = ($page-1) * 5;
$query = pg_query($dbconn,"select * from my table limit 5 offset $start_from") or die(pg_result_error($dbconn));
$total_query = pg_num_rows($query);
$total_pages = ceil($total_query / 5);
Buttons and Links:
for ($i=1; $i<=$total_pages; $i++) {
echo "<a href='index.php?page=".$i."' class=\"textPagina\">".$i."</a> ";
}
good, if it was negative can also inform what the problem? would be more useful!!!!!
– user26858