Server-side Processing DataTables using PHP with MySQL

Server-side Processing DataTables using PHP with MySQL

In this Post We Will Explain About is Server-side Processing DataTables using PHP with 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 Example – Server-side Processing with PHP Example

In this post we will show you Best way to implement jQuery Datatables Server Side Processing with PHP & MySQL, hear for DataTables – Server-side Processing in Codeigniter using Ajax with Download .we will give you demo,Source Code and examples for implement Step By Step Good Luck!.

DataTables Server-side Processing using PHP with MySQL

DataTables is a one type of the jQuery External library used to Show the list of all Database records in a HTML View table with an dynamic interface.and then DataTables includes some more features like as a dataTable search, dataTable pagination, dataTable sort, dataTable filter and more dataTable features available.”DataTables Server-side”

Free Live Chat for Any Issue

Include External Libs

	<link rel="stylesheet"  href="datatables.min.css">	
	<link rel="stylesheet"  href="style.css">	
	<script src="jquery-1.11.2.min.js" type="text/javascript"></script>
    <script src="datatables.min.js" type="text/javascript"></script> 	


The following source code shows the HTML DataTable source code for the dynamic DataTable.

Also Read This πŸ‘‰   PHP Ajax Form Validation without page refresh

<div class="container">
	<table id="student-details" class="live-dt nowrap" cellspacing="0" width="100%">
		<th>Student First Name</th>
		<th>Student Last Name</th>
		<th>Student Address</th>
		<th>Student Phone</th>
		<th>Student DOB</th>


The following source code Display the jQuery based DataTable all the row initialization by setting custom the required some DataTable each property.and then It’s server Side PHP based property is set as Boolean value set like as a true and the server side PHP file path is some set specified for call the Ajax property.

// call do_server.php using jquery
$(document).ready(function() {
		"scrollX": true,
		"pagingType": "numbers",
        "processing": true,
        "serverSide": true,
        "ajax": "do_server.php"
    } );
} );


do_server.php files declares the database config setting configuration details store, student table name, all the columns and sends then to the simple external domain class to process the MySQL SELECT query.


//devloped by DB table to use
$db_table = 'tbl_contact';
//devloped by Table's primary key
$primaryKey = 'id';

$stud_data_col = array(
    array( 'db' => 'fname', 'dt' => 0 ),
    array( 'db' => 'lname',  'dt' => 1 ),
    array( 'db' => 'stud_address',   'dt' => 2 ),
    array( 'db' => 'stud_phone', 'dt' => 3,),
    array( 'db' => 'stud_date_of_birth','dt' => 4,
        'formatter' => function( $d, $row ) {
            return date( 'd-m-Y', strtotime($d));
//Live SQL server database connection information
$stud_details = array(
    'user' => 'live24u',
    'pass' => '[email protected]',
    'db'   => 'myclassstud',
    'host' => 'localhost'
//import external libs
require( 'vendor/datatables/ssp.class.php' );
echo json_encode(
    SSP::simple( $_GET, $stud_details, $db_table, $primaryKey, $stud_data_col )


.dataTables_wrapper .dataTables_paginate .paginate_button {
    color: #4D525B !important;	
    padding: 0.4em 0.8em;
    border: #4D525B 2px solid;;
.dataTables_wrapper .dataTables_paginate .paginate_button.current, .dataTables_wrapper .dataTables_paginate .paginate_button.current:hover {
    color: #3d3d3d !important;
	background: unset !important;
	border: #4D525B 2px solid !important;
    background-color: #4D525B !important;
	cursor: default;
table.dataTable.row-border tbody th, table.dataTable.row-border tbody td, tbody th, tbody td {
    border: 2px solid #eee;
    border-left: none;
    border-top: none;
.dataTables_wrapper select,.dataTables_wrapper input 
	border:2px solid #eee;
.dataTables_wrapper .dataTables_paginate .paginate_button:hover {
    color: #4D525B !important;
	border-color: #4D525B !important;
    background-color: #4D525B !important;
table.dataTable.stripe tbody tr.odd, tbody tr.odd {
    background-color: #3d3d3d;
} tbody tr.even>.sorting_1, table.dataTable.order-column.stripe tbody tr.even>.sorting_1 {
    background-color: #f3f3f3; 
} tbody tr.odd>.sorting_1, table.dataTable.order-column.stripe tbody tr.odd>.sorting_1 {
    background-color: #3d3d3d; 
table.dataTable thead th, table.dataTable thead td {
	border: 2px solid #eee;
    border-left: none;
table.dataTable.stripe tbody tr.even, tbody tr.even {
    background-color: #f3f3f3;
	padding-bottom: 15px;
	border-left:2px solid #eee;

You are Most welcome in my youtube Channel Please subscribe my channel. and give me FeedBack.
More Details……
Angularjs Example

Also Read This πŸ‘‰   Get Gravatar Image Using PHP Example


I hope you have Got What is Server Side Processing DataTable with PHP and MySQL And how it works.I would Like to have Feed Back From My Blog( readers.Your Valuable Feed Back,Any Question,or any Comments about This Article( Are Most Always Welcome.

Rate this post