I am making pagination in PHP. I need to store records from db to an table and show it on page. I need to mark every record starting from 1 to the end (1,2,3,4....). The script I am using works fine, but I have only one problem regarding marking records. For ex. I want 30 records per page and 30 records are shown correctly 1-30, but when I go to second page numbering starts all over again (It goes again 1-30, instead 31-60), basically numbering is same on every page (1-30). Here is the part of a script where numbering is done.
$no=0;
while($row = mysqli_fetch_array($res_data)){
$no++;
echo "<center><table><tr><td style='width: 20%;'>" .$no. "</td><td>" . $row["username"]. "</td><td style='width: 20%;'>" . $row["score"] . "</td></tr>";
echo "</table></center>";
}
I did not show entire script for pagination, since I think there is no need to because the problem is probably with the $no var. Any help is appreciated!