Jump to content

Function Help


phpcodec

Recommended Posts

function pagination($current_page,$total_rows)
{
$current_page = (!is_numeric($current_page))?'1':$current_page;
$results_per_page = '24';
echo '<b>Select A Page:</b><br />';
if($total_rows=='0')
{
echo 'No Pages Available';
$start = '0';
$finish = '0';
}
else
{
$total_pages = ceil($total_rows/$results_per_page);
if($current_page>'1')
{
echo '<a href="?page='.($current_page-1).'"><<Previous</a> ';
}
for($i='1';$i<=$total_pages;$i++)
{
if($current_page==$i)
{
echo '<a href="?page='.$i.'"><b>['.$i.']</b></a> ';
}
else
{
echo '<a href="?page='.$i.'">'.$i.'</a> ';
}
}
if($current_page<$total_pages)
{
echo '<a href="?page='.($page+1).'">Next>></a> ';
}
$start = $current_page*$results_per_page-$results_per_page;
$finish = $results_per_page;
}
}


pagination($_GET['page'],$row);
echo $start.' '.$finish;

 

When i echo $start and $finish after i call the function pagination() it does'nt show anything, how can make this work?

Link to comment
Share on other sites

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.