Posted inProgramming / Mysql / Mysqli / php

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 Pakainfo.com – 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”

Include External Libs

		
		
	
     	

index.php

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


Student First Name Student Last Name Student Address Student Phone Student DOB

index.js

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() {
    $('#student-details').dataTable({
		"scrollX": true,
		"pagingType": "numbers",
        "processing": true,
        "serverSide": true,
        "ajax": "do_server.php"
    } );
} );

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.

 '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' => 'live@#dhk24u.com',
    '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 )
);

style.css

.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, table.dataTable.live-dt tbody th, table.dataTable.live-dt tbody td {
    border: 2px solid #eee;
    border-left: none;
    border-top: none;
}
.dataTables_wrapper select,.dataTables_wrapper input 
{
	border:2px solid #eee;
	padding:0.4em;
}
.dataTables_wrapper .dataTables_paginate .paginate_button:hover {
    color: #4D525B !important;
	border-color: #4D525B !important;
    background-color: #4D525B !important;
	background:unset;
}
table.dataTable.stripe tbody tr.odd, table.dataTable.live-dt tbody tr.odd {
    background-color: #3d3d3d;
}
table.dataTable.live-dt tbody tr.even>.sorting_1, table.dataTable.order-column.stripe tbody tr.even>.sorting_1 {
    background-color: #f3f3f3; 
}
table.dataTable.live-dt 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, table.dataTable.live-dt tbody tr.even {
    background-color: #f3f3f3;
}
.datatables_length{
	padding-bottom: 15px;
}
table.dataTable{
	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

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(Pakainfo.com) readers.Your Valuable Feed Back,Any Question,or any Comments about This Article(Pakainfo.com) Are Most Always Welcome.

I am Jaydeep Gondaliya , a software engineer, the founder and the person running Pakainfo. I'm a full-stack developer, entrepreneur and owner of Pakainfo.com. I live in India and I love to write tutorials and tips that can help to other artisan, a Passionate Blogger, who love to share the informative content on PHP, JavaScript, jQuery, Laravel, CodeIgniter, VueJS, AngularJS and Bootstrap from the early stage.

Leave a Reply

Your email address will not be published. Required fields are marked *

We accept paid guest Posting on our Site : Guest Post Chat with Us On Skype