Ragazzi mi date una mano ha sistemare questo codice...
non mi stampa tutti i numeri ma solo 1 e 2
Codice PHP:
<?php
$count = mysql_query("SELECT id FROM nome_tabella");
$tot_records = mysql_num_rows($count);
$per_pagina = 5;
$tot_pages = ceil($tot_records / $per_page);
$current_page = (!$_GET["pag"]) ? 1 : (int)$_GET["pag"];
$start = ($current_page - 1) * $per_pagina;
$query = mysql_query("SELECT * FROM nome_tabella LIMIT {$start}, {$per_pagina}");
$go = $current + 1;
$back = $current - 1;
$pagination = null;
if($tot_pages > 1) {
for($i = 1; $i <= $tot_pages; $i++) {
$pagination .= "<a href=\"{$_SERVER["PHP_SELF"]}?page={$i}\">{$i}</a>\n";
}}
$pagination = trim($pagination);
if(!empty($pagination)) {
if($current == $tot_pages) {
$pagination = "<a href=\"{$_SERVER["PHP_SELF"]}?pag={$back}\">«</a>\n" .$pagination;
}else if($current == 1) {
$pagination = $pagination . "\n<a href=\"{$_SERVER["PHP_SELF"]}?pag={$go}\">»</a>";
} else {
$pagination = "<a href=\"{$_SERVER["PHP_SELF"]}?pag={$back}\">«</a>\n" .$pagination. "\n<a href=\"/index.php?pag={$go}\">»</a>";
}}
echo $pagination;
?>