Easy PHP Pagination

I’ve had a few pagination scripts over the years but I thought i’d share the one that i’m currently using as it’s a useful script to have in your website. As a developer you’ll soon find a need to paginate data when displaying contents from the database, and rather than use JavaScript which could require all the data to be loaded into the page on load, we can use PHP to ensure that we’re only requesting the data that we need from the database. For those who have no clue what i’m talking about. Pagination is a way of splitting up data into manageable chunks to display to a user, if you’ve spent more than two minutes on the internet chances are you’ve come into contact with some form of pagination. as a simple example you can checkout my website and allows you to split data up with it being paginated across however many pages dynamically.
 1)
	{	
	

	
	
		$pagination .= "";		
	
	
}
 echo $total_pages.' Results';
 // pagination
 echo $pagination;
?>

    '.$row['country'].' '; } ?>
Here’s the css to style you pagination

0 comments:

Post a Comment