include_once("header.php"); ?> |
|
|
|
|
|
|
include_once("left.php"); ?> |
include_once("middle.php"); ?>
|
|
|
|
|
|
|
|
|
|
|
#==========================================
# PAGING
#==========================================
$page = $_REQUEST['page'];
if(isset($_REQUEST['paginglen'])&& $_REQUEST['paginglen']!="")
$limit = $_REQUEST['paginglen'];
elseif(isset($_REQUEST['mypagelen'])&& $_REQUEST['mypagelen']!="")
$limit = $_REQUEST['mypagelen'];
else
$limit = 20;
class Pager
{
function getPagerData($numHits, $limit, $page)
{
$numHits = (int) $numHits;
$limit = max((int) $limit, 1);
$page = (int) $page;
$numPages = ceil($numHits / $limit);
$page = max($page, 1);
$page = min($page, $numPages);
$offset = ($page - 1) * $limit;
$ret = new stdClass;
$ret->offset = $offset;
$ret->limit = $limit;
$ret->numPages = $numPages;
$ret->page = $page;
return $ret;
}
}
$sql_cnt="SELECT count(*) FROM noleggio_strument WHERE name='servizi_album'";
$qry_cnt=mysql_query($sql_cnt) or die(mysql_error());
$row_cnt=mysql_fetch_array($qry_cnt);
$total=$row_cnt[0];
$pager = Pager::getPagerData($total, $limit, $page);
if($total==0)
$offset=0;
else
$offset = $pager->offset;
$limit = $pager->limit;
$page = $pager->page;
#==================================================================
$sql="SELECT * FROM noleggio_strument WHERE name='servizi_album' ORDER BY sort_order limit $offset, $limit";
$qry=mysql_query($sql) or die(mysql_error());
if(mysql_num_rows($qry)>0)
{ ?>
while($row=mysql_fetch_array($qry))
{ ?>
|
if($row['price']!="")
{ ?>
Prezzo : =$row['price']?> € al giorno |
} ?>
|
=$row['description']?>
|
}
?>
}
?> |
|
|
if($total!=0)
{
if($pager->numPages>1)
{
#============================================
# PAGING
#============================================
// use pager values to fetch data
$result = $qry;
// use $result here to output page content
// output paging system (could also do it before we output the page content)
if ($page == 1) // this is the first page - there is no previous page
{
// echo "Previous";
$j = $page;
}
else
{ // not the first page, link to the previous page
echo "Indietro";
$j = ($page-1)*$limit+1;
}
/*for ($i = 1; $i <= $pager->numPages; $i++) {
echo " | ";
if ($i == $pager->page)
echo " $i";
else
echo " $i";
} */
if ($page == $pager->numPages) // this is the last page - there is no next page
// echo " | Next";
echo " | ";
else // not the last page, link to the next page
echo " | Altra Strumentazione";
echo "
";
#====================================================
}
}
?> |
|
|
|
|
include_once("footer.php"); ?> |
|