I have this code:
$total = 12;
$limitPerPage = 6;
$totalPages = ceil($total / $limitPerPage);
$p = $_GET['p'];
echo $p;
echo 'Total pages: ' . $totalPages . '<br /><br />';
$limitRow = 3;
$totalRow = ceil($total / $limitRow);
for($i = 1; $i <= $totalRow; $i++){
$row = ($i * $limitRow) - $limitRow;
echo "From " . $row . ": ";
for($j = 1; $j <= $limitRow; $j++){
echo $row + $j . " ";
}
echo '<br />';
What i want is to get pagination something like that: First page would have:
From 0: 1 2 3
From 3: 4 5 6
Second page:
From 6: 7 8 9
From 9: 10 11 12
Etc... Now i have set per page 6, but maybe later i change to 9 or 12... This is code for geting from sql and it needs to be in that way with for loops throught each for and than limiting each row. Any ideas how to reach that? I know i can just make $limit 6 and will get 6 per page, but main important thing is that i limit each row.
UPDATE: It works in that way:
<div id="ref1"></div>
<div id="ref2"></div>
<div id="ref3"></div>
<div id="completeref">
<div id="ref1"></div>
<div id="ref2"></div>
<div id="ref3"></div>
</div>
That way is for each row after 3 divs then i create new div with all 3 divs in it.