COLLEZIONI
L\'errore restituito : ', mysql_error(),''; exit; } $righe = mysql_num_rows($resource); if ($righe == 0){ return false; } $numpages = ceil($righe/$x_pag); $pag = isset($_GET['pag'])? $_GET['pag'] : 1; $da = ($pag-1) * $x_pag; $query .= " LIMIT $da,$x_pag"; $querystring = ''; foreach($_GET as $k => $v) { if ($k != 'pag') { $querystring .= "&".$k."=".$v; } } $menu = ''; if($numpages <= $num_links) { for ($pagina = 1; $pagina <= $numpages; $pagina++) { if ($pagina == $pag) $menu .= "
$pagina
"; else $menu .= "
$pagina
"; } } else if($pag <= ceil($num_links/2)) { for ($pagina=1; $pagina<=$num_links; $pagina++) { if ($pagina == $pag) $menu .= "
$pagina
"; else $menu .= "
$pagina
"; } $menu .= "
>>
"; } else if($pag > ($numpages-ceil($num_links/2))) { $menu .= "
<<
"; for ($pagina=$numpages-$num_links+1; $pagina<=$numpages; $pagina++) { if ($pagina == $pag) $menu .= "
$pagina
"; else $menu .= "
$pagina
"; } } else { $menu .= "
<<
"; for ($pagina = $pag-ceil($num_links/2-1); $pagina <= $pag+ceil($num_links/2-1); $pagina++) { if ($pagina == $pag) $menu .= "
$pagina
"; else $menu .= "
$pagina
"; } $menu .= "
>>
"; } return array(mysql_query($query),$menu); } ?>