How to create a Pagination in PHP and MySQL with AJAX

In this article i am belonging to explicate you how to create pagination in PHP & MySQL on AJAX as your websites. Pagination is a very all important part in your websites reporting and this article will help you to create it very really simple.

How to create a Pagination in PHP and MySQL with AJAX

Database name => phpgang
Board name => pagination
Column names => id, post, postlink

DB.sql

Database file away run in your mysql to make database and add up data in table.

create database `wahitworld`;
use `wahitworld`;
CREATE TABLE `pagination` (
`id` int(11) NOT NULL auto_increment,
`post` varchar(250) NOT NULL,
`postlink` varchar(250) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=48 DEFAULT CHARSET=latin1 AUTO_INCREMENT=48 ;

INSERT INTO `pagination` VALUES (1, ‘How to Resize text using jQuery’, ‘http://www.wahitworld.com/?p=312’);
INSERT INTO `pagination` VALUES (2, ‘How to Integrate live search in PHP and MySQL with jQuery’, ‘http://www.wahitworld.com/?p=309’);
INSERT INTO `pagination` VALUES (3, ‘How to implement jquery Timeago with php’, ‘http://www.wahitworld.com/?p=290’);
INSERT INTO `pagination` VALUES (4, ‘How to Mask an input box in jQuery’, ‘http://www.wahitworld.com/?p=304’);
INSERT INTO `pagination` VALUES (5, ‘How to block Inappropriate content with javascript validation’, ‘http://www.wahitworld.com/?p=301’);
INSERT INTO `pagination` VALUES (6, ‘How to Crop Image with jQuery and PHP’, ‘http://www.wahitworld.com/?p=298’);
INSERT INTO `pagination` VALUES (7, ‘How to Integrate jQuery Scroll Paging with PHP’, ‘http://www.wahitworld.com/?p=294’);
INSERT INTO `pagination` VALUES (8, ‘Bug Reporting with Windows Program Steps Recorder (PSR)’, ‘http://www.wahitworld.com/?p=291’);
INSERT INTO `pagination` VALUES (9, ‘How to Configure Google Cloud API in PHP’, ‘http://www.wahitworld.com/?p=288’);
INSERT INTO `pagination` VALUES (10, ‘How to convert text to MP3 Voice’, ‘http://www.wahitworld.com/?p=284’);

How to create a Pagination in PHP and MySQL with AJAX

style.css

How to create a Pagination in PHP and MySQL with AJAX

Use Css for style.

<style type=”text/css”>
ul.tsc_pagination { margin:4px 0; padding:0px; height:100%; overflow:hidden; font:12px \’Tahoma\’; list-style-type:none; }
ul.tsc_pagination li { float:left; margin:0px; padding:0px; margin-left:5px; }
ul.tsc_pagination li:first-child { margin-left:0px; }
ul.tsc_pagination li a { color:black; display:block; text-decoration:none; padding:7px 10px 7px 10px; }
ul.tsc_pagination li a img { border:none; }
ul.tsc_paginationC li a { color:#707070; background:#FFFFFF; border-radius:3px; -moz-border-radius:3px; -webkit-border-radius:3px; border:solid 1px #DCDCDC; padding:6px 9px 6px 9px; }
ul.tsc_paginationC li { padding-bottom:1px; }
ul.tsc_paginationC li a:hover,
ul.tsc_paginationC li a.current { color:#FFFFFF; box-shadow:0px 1px #EDEDED; -moz-box-shadow:0px 1px #EDEDED; -webkit-box-shadow:0px 1px #EDEDED; }
ul.tsc_paginationC01 li a:hover,
ul.tsc_paginationC01 li a.current { color:#893A00; text-shadow:0px 1px #FFEF42; border-color:#FFA200; background:#FFC800; background:-moz-linear-gradient(top, #FFFFFF 1px, #FFEA01 1px, #FFC800); background:-webkit-gradient(linear, 0 0, 0 100%, color-stop(0.02, #FFFFFF), color-stop(0.02, #FFEA01), color-stop(1, #FFC800)); }
ul.tsc_paginationC li a.In-active {
pointer-events: none;
cursor: default;
}
</style>

How to create a Pagination in PHP and MySQL with AJAX

index.php

Index file contain pages logic.PHP

%d bloggers like this: