Codice PHP:
<?
$max=5; //elementi_pagina
//sql per recuperare elenco camperservice con condizioni in ingresso....
$sql_count="select count(*) as conteggio from camperservice where id=id
$where_localita $where_citta $where_regione $where_stato $where_cs
$where_aa $where_ps $where_camper_stop $where_wifi $where_gratis";
//print "-$sql-";
//print ("-$sql-
");
$ask=mysql_query($sql_count,$dbconn);
$out="";
while($res=mysql_fetch_array($ask,MYSQL_ASSOC))
foreach ($res as $key=>$arr)
$out[]=$arr;
mysql_free_result($ask);
$pos=array();
foreach ($out as $key=>$val)
{
if (is_int($key/$max))
$pos[]=$key;
}
$page=array();
foreach ($pos as $key=>$val)
{
$page[$key]=Array();
$page[$key]=array_slice($arr,$val,$max);
}
echo "<pre>";
print_r($page);
foreach ($page[$_GET['pag']] as $key=>$val)
foreach $val as $chiave=>$valore
echo $chiave è $valore."
";
foreach($page as $key=>$val)
print "<a href=\"page.php?pag=$key\"> ".($key+1)." </a>";
?>
dovrebbe funzionare....