I'm trying to make some kind of pagination system.
Each page has a maximum of 4 elements that came from a DB.
Each page is surronded by a div (div id='p1' class='pagedemo _current'). So I have the following:
$i=0;
$pag=0;
$arr = array();
while($rowNews = mysql_fetch_array($rsNews)){
$i++;
$arr[$i] = $rowNews;
if($i%4==1){
echo "div id='p1' class='pagedemo _current'"
}
...show content...
if($i%4 ==0 ){
echo"</div>"; //close the tag of class="pagedemo"
}
}//end of while
This open a div when the i is 1; 5 ; 9.... and closes when is multiple of 4 (4; 8; 12...) But I also want to close the div when $i its the last number, ie: If there's only 6 results I want to close the div after the 6th element.
I'm not accomplish it
Any ideas??