i am using jquery ajax pagination code, i need some changes.
<?php
$per_page = 4;
$sql = "select * from portfolio ";
$rsd = mysql_query($sql);
$count = mysql_num_rows($rsd);
$pages = ceil($count/$per_page)
?>
the above code calculates the number of pages then
<?php
//Show page links
for($i=1; $i<=$pages; $i++)
{
echo '<li class="pagenum" id="'.$i.'">'.$i.'</li>';
}
?>
this code display pagination button that is basically
<li class="pagenum" id="'.$i.'">'.$i.'</li>
all the problem is here with $i .
if $per_page=4 then 7 pagination button appears .
pagination occur on basis of
id="'.$i.'"
this way
$("#paging_button li").click(function(){
//show the loading bar
showLoader();
$("#paging_button li").css({'background-color' : ''});
$(this).css({'background-color' : '#ccc'});
$("#contentt").load("data.php?page=" + this.id, hideLoader);
});
what i want is to display only next and previous button . instead of seven pagination buttons .
need to change to logic/code .
please help
thanks
1 Answer