The first 2 lines of the above code are used to create a $start_from variable depending on the page that we want to view. Later you will see that we will pass a “page†value using the URL (e.g. pagination.php?page=2) to go to different pages. Next we need to find out the total amount of records in our table and the number of pages that we will need. To do this we run another query using COUNT() function.