DataTables Pagination Server-side Processing using PHP and MySQL

DataTables Pagination Server-side Processing using PHP and MySQL

In this Post We Will Explain About is DataTables Pagination Server-side Processing using PHP and MySQL With Example and Demo.Welcome on – Examples, The best For Learn web development Tutorials,Demo with Example! Hi Dear Friends here u can know to DataTables Server-side Processing using PHP with MySQLExample

In this post we will show you Best way to implement DataTable Pagination using PHP & MySQL Example, hear for create jQuery Datatable pagination using PHP and MySQLwith Download .we will give you demo,Source Code and examples for implement Step By Step Good Luck!.

Read Also:  Server side Laravel DataTables example

Project Structure


Mysql Table : create table structure

CREATE TABLE `students` (
`id` int(11) NOT NULL COMMENT 'primary key',
`stud_name` varchar(255) NOT NULL COMMENT 'students name',
`stud_fees` double NOT NULL COMMENT 'students salary',
`stud_age` int(11) NOT NULL COMMENT 'students age'


$yoursname = "localhost";
$username = "root";
$password = "[email protected]";
$dbname = "pakainfo";
$conn = mysqli_connect($yoursname, $username, $password, $dbname);

jquery library files

<script src=""></script>
<link rel="stylesheet" type="text/css" href="https:////">
<script src="https:////"></script>


<div class="container">
<h2>Simple jQuery DataTable server side Pagination using PHP & MySQL Examples</h2>
<div class="row">
<table id="livedatatable" class="display" width="100%" cellspacing="0">
<div style="margin:50px 0px 0px 0px;">
<a class="btn btn-default read-more" style="background:#3399ff;color:white" href="" title="free Download All Example">Back to Tutorial</a>


jQuery( document ).ready(function() {
var table = jQuery('#livedatatable').dataTable({
"bProcessing": true,
"sAjaxSource": "data_allpage.php",
"iDisplayLength": 10,
"bFilter": false,
"aoColumns": [
{ mData: 'stud_id' } ,
{ mData: 'Name' },
{ mData: 'fees' }


$sql = "SELECT id as stud_id,stud_name as Name,stud_fees as fees FROM students LIMIT 20";
$dataresults = mysqli_query($conn, $sql) or die("simple your database error:". mysqli_error($conn));
$studarray = array();
while( $datarows = mysqli_fetch_assoc($dataresults) ) {
$studarray[] = $datarows;
$results = array(
"sEcho" => 1,
"iTotalRecords" => count($studarray),
"iTotalDisplayRecords" => count($studarray),
echo json_encode($results);


Read Also:  PHP Codeigniter 3 Multiple WHERE conditions Example

I hope you have Got What is DataTables Server-side Processing using PHP with MySQL And how it works.I would Like to have FeadBack From My Blog( readers.Your Valuable FeadBack,Any Question,or any Comments abaout This Article( Are Most Always Welcome.

Related FAQ

Here are some more FAQ related to this Article:

  1. Read Also:  Top 5 Free Dynamic ZIP Generation Libraries in PHP
  2. Read Also:  How to implement pagination with server side get api in Datatables?
  3. Read Also:  Top 10 Advanced PHP Interview Questions Answers
  4. Read Also:  Laravel 6.2 Eloquent Relationship Tutorial
  5. Read Also:  Mouseover and Mouseout Effects using Jquery Example
  6. Read Also:  Jquery Datatable listing json Server side in Php Mysql and Ajax
  7. Read Also:  Angular2 Datatable Pagination, Sorting and Searching
  8. Read Also:  PHP File file_get_contents Handling Function
  9. Read Also:  Import and Export CSV File using Laravel 6 and MySQL
  10. Read Also:  sql subquery examples