{"id":5567,"date":"2024-03-07T06:05:59","date_gmt":"2024-03-07T06:05:59","guid":{"rendered":"https:\/\/www.codexworld.com\/?p=5567"},"modified":"2025-08-16T04:20:56","modified_gmt":"2025-08-16T04:20:56","slug":"datatables-column-filtering-with-server-side-processing-using-php","status":"publish","type":"post","link":"https:\/\/www.codexworld.com\/datatables-column-filtering-with-server-side-processing-using-php\/","title":{"rendered":"DataTables Column Filtering with Server-side Processing using PHP"},"content":{"rendered":"<p><b>DataTables<\/b> is a JavaScript library used to enhance the functionality and add advanced features to HTML tables. The DataTables plugin converts a basic HTML table into an advanced feature-rich table instantly. There are various advanced features available with DataTables, and server-side processing is one of them. <a href=\"https:\/\/www.codexworld.com\/datatables-server-side-processing-with-php-mysql\/\">DataTables server-side processing<\/a> enables you to load a large number of data sets from the database. By setting the server-side option, the search, pagination, and column sorting operations will be handled with the server-side script and database.<\/p>\n<p>Column filtering is a very useful option to help the user find specific records in a large amount of data. The DataTables library provides an easy option to add search and filtering features to each column of the data table. You can apply the column filtering functionality in DataTables with Server-side Processing. In this tutorial, we will show you how to integrate <b>column filtering in DataTables<\/b> Server-side Processing with PHP.<\/p>\n<p>In the example script, we will list dynamic data in DataTables with Server-side processing and add column filtering using PHP. <\/p>\n<ul>\n<li>Fetch and list data from the MySQL database using DataTables Server-side Processing.<\/li>\n<li>Place the column filter option at the header of the table.<\/li>\n<li>Add input to each column for search and filter records by column value.<\/li>\n<\/ul>\n<p>Before getting started to integrate individual column filters in DataTables with PHP, take a look at the file structure.<\/p>\n<pre class=\"file-struc\">datatables_column_filtering_with_php<span style=\"color:#794938\">\/<\/span>\r\n\u251c\u2500\u2500 index.html\r\n\u251c\u2500\u2500 fetchData.php\r\n\u251c\u2500\u2500 ssp.class.php\r\n\u251c\u2500\u2500 DataTables<span style=\"color:#794938\">\/<\/span>\r\n\u2502   \u251c\u2500\u2500 datatables.min.css\r\n\u2502   \u2514\u2500\u2500 datatables.min.js\r\n\u2514\u2500\u2500 js<span style=\"color:#794938\">\/<\/span>\r\n    \u2514\u2500\u2500 jquery.min.js\r\n<\/pre>\n<h2>Create Database Table<\/h2>\n<p>A table is required in the database to display records in the DataTables dynamically. The following SQL creates a <code>members<\/code> table with some basic fields in the MySQL database.<\/p>\n<pre style=\"color: rgb(0, 0, 0);\"><span class=\"hljs-keyword\" style=\"color: rgb(149, 65, 33);\">CREATE<\/span> <span class=\"hljs-keyword\" style=\"color: rgb(149, 65, 33);\">TABLE<\/span> <span class=\"hljs-string\" style=\"color: rgb(33, 145, 97);\">`members`<\/span> (\r\n <span class=\"hljs-string\" style=\"color: rgb(33, 145, 97);\">`id`<\/span> <span class=\"hljs-built_in\" style=\"color: rgb(0, 134, 179);\">int<\/span>(<span class=\"hljs-number\" style=\"color: rgb(64, 160, 112);\">11<\/span>) <span class=\"hljs-keyword\" style=\"color: rgb(149, 65, 33);\">NOT<\/span> <span class=\"hljs-literal\" style=\"color: rgb(149, 65, 33);\">NULL<\/span> AUTO_INCREMENT,\r\n <span class=\"hljs-string\" style=\"color: rgb(33, 145, 97);\">`first_name`<\/span> <span class=\"hljs-built_in\" style=\"color: rgb(0, 134, 179);\">varchar<\/span>(<span class=\"hljs-number\" style=\"color: rgb(64, 160, 112);\">25<\/span>) <span class=\"hljs-keyword\" style=\"color: rgb(149, 65, 33);\">COLLATE<\/span> utf8_unicode_ci <span class=\"hljs-keyword\" style=\"color: rgb(149, 65, 33);\">NOT<\/span> <span class=\"hljs-literal\" style=\"color: rgb(149, 65, 33);\">NULL<\/span>,\r\n <span class=\"hljs-string\" style=\"color: rgb(33, 145, 97);\">`last_name`<\/span> <span class=\"hljs-built_in\" style=\"color: rgb(0, 134, 179);\">varchar<\/span>(<span class=\"hljs-number\" style=\"color: rgb(64, 160, 112);\">25<\/span>) <span class=\"hljs-keyword\" style=\"color: rgb(149, 65, 33);\">COLLATE<\/span> utf8_unicode_ci <span class=\"hljs-keyword\" style=\"color: rgb(149, 65, 33);\">NOT<\/span> <span class=\"hljs-literal\" style=\"color: rgb(149, 65, 33);\">NULL<\/span>,\r\n <span class=\"hljs-string\" style=\"color: rgb(33, 145, 97);\">`email`<\/span> <span class=\"hljs-built_in\" style=\"color: rgb(0, 134, 179);\">varchar<\/span>(<span class=\"hljs-number\" style=\"color: rgb(64, 160, 112);\">50<\/span>) <span class=\"hljs-keyword\" style=\"color: rgb(149, 65, 33);\">COLLATE<\/span> utf8_unicode_ci <span class=\"hljs-keyword\" style=\"color: rgb(149, 65, 33);\">NOT<\/span> <span class=\"hljs-literal\" style=\"color: rgb(149, 65, 33);\">NULL<\/span>,\r\n <span class=\"hljs-string\" style=\"color: rgb(33, 145, 97);\">`gender`<\/span> enum(<span class=\"hljs-string\" style=\"color: rgb(33, 145, 97);\">'Male'<\/span>,<span class=\"hljs-string\" style=\"color: rgb(33, 145, 97);\">'Female'<\/span>) <span class=\"hljs-keyword\" style=\"color: rgb(149, 65, 33);\">COLLATE<\/span> utf8_unicode_ci <span class=\"hljs-keyword\" style=\"color: rgb(149, 65, 33);\">NOT<\/span> <span class=\"hljs-literal\" style=\"color: rgb(149, 65, 33);\">NULL<\/span>,\r\n <span class=\"hljs-string\" style=\"color: rgb(33, 145, 97);\">`country`<\/span> <span class=\"hljs-built_in\" style=\"color: rgb(0, 134, 179);\">varchar<\/span>(<span class=\"hljs-number\" style=\"color: rgb(64, 160, 112);\">20<\/span>) <span class=\"hljs-keyword\" style=\"color: rgb(149, 65, 33);\">COLLATE<\/span> utf8_unicode_ci <span class=\"hljs-keyword\" style=\"color: rgb(149, 65, 33);\">NOT<\/span> <span class=\"hljs-literal\" style=\"color: rgb(149, 65, 33);\">NULL<\/span>,\r\n <span class=\"hljs-string\" style=\"color: rgb(33, 145, 97);\">`created`<\/span> datetime <span class=\"hljs-keyword\" style=\"color: rgb(149, 65, 33);\">NOT<\/span> <span class=\"hljs-literal\" style=\"color: rgb(149, 65, 33);\">NULL<\/span>,\r\n <span class=\"hljs-string\" style=\"color: rgb(33, 145, 97);\">`status`<\/span> tinyint(<span class=\"hljs-number\" style=\"color: rgb(64, 160, 112);\">1<\/span>) <span class=\"hljs-keyword\" style=\"color: rgb(149, 65, 33);\">NOT<\/span> <span class=\"hljs-literal\" style=\"color: rgb(149, 65, 33);\">NULL<\/span> <span class=\"hljs-keyword\" style=\"color: rgb(149, 65, 33);\">DEFAULT<\/span> <span class=\"hljs-number\" style=\"color: rgb(64, 160, 112);\">1<\/span> <span class=\"hljs-keyword\" style=\"color: rgb(149, 65, 33);\">COMMENT<\/span> <span class=\"hljs-string\" style=\"color: rgb(33, 145, 97);\">'1=Active | 0=Inactive'<\/span>,\r\n PRIMARY <span class=\"hljs-keyword\" style=\"color: rgb(149, 65, 33);\">KEY<\/span> (<span class=\"hljs-string\" style=\"color: rgb(33, 145, 97);\">`id`<\/span>)\r\n) <span class=\"hljs-keyword\" style=\"color: rgb(149, 65, 33);\">ENGINE<\/span>=<span class=\"hljs-keyword\" style=\"color: rgb(149, 65, 33);\">InnoDB<\/span> <span class=\"hljs-keyword\" style=\"color: rgb(149, 65, 33);\">DEFAULT<\/span> <span class=\"hljs-keyword\" style=\"color: rgb(149, 65, 33);\">CHARSET<\/span>=utf8 <span class=\"hljs-keyword\" style=\"color: rgb(149, 65, 33);\">COLLATE<\/span>=utf8_unicode_ci;<\/pre>\n<h2>DataTables Column Filtering with Server-side Processing (index.html)<\/h2>\n<p>On page load, the DataTables class is initialized, and dynamic data is fetched from the server side and listed in an HTML table with search input in each column.<\/p>\n<p><b>Create HTML Table:<\/b><br \/>\nDefine the HTML table element and specify an ID (<code>memListTable<\/code>) to attach DataTables.<\/p>\n<pre style=\"color: rgb(95, 94, 78);\"><span class=\"hljs-tag\" style=\"color: rgb(186, 98, 54);\">&lt;<span class=\"hljs-name\" style=\"color: rgb(186, 98, 54);\">table<\/span> <span class=\"hljs-attr\">id<\/span>=<span class=\"hljs-string\" style=\"color: rgb(125, 151, 38);\">\"memListTable\"<\/span> <span class=\"hljs-attr\">class<\/span>=<span class=\"hljs-string\" style=\"color: rgb(125, 151, 38);\">\"display\"<\/span> <span class=\"hljs-attr\">style<\/span>=<span class=\"hljs-string\" style=\"color: rgb(125, 151, 38);\">\"width:100%\"<\/span>&gt;<\/span>\r\n    <span class=\"hljs-tag\" style=\"color: rgb(186, 98, 54);\">&lt;<span class=\"hljs-name\" style=\"color: rgb(186, 98, 54);\">thead<\/span>&gt;<\/span>\r\n        <span class=\"hljs-tag\" style=\"color: rgb(186, 98, 54);\">&lt;<span class=\"hljs-name\" style=\"color: rgb(186, 98, 54);\">tr<\/span>&gt;<\/span>\r\n            <span class=\"hljs-tag\" style=\"color: rgb(186, 98, 54);\">&lt;<span class=\"hljs-name\" style=\"color: rgb(186, 98, 54);\">th<\/span>&gt;<\/span>First name<span class=\"hljs-tag\" style=\"color: rgb(186, 98, 54);\">&lt;\/<span class=\"hljs-name\" style=\"color: rgb(186, 98, 54);\">th<\/span>&gt;<\/span>\r\n            <span class=\"hljs-tag\" style=\"color: rgb(186, 98, 54);\">&lt;<span class=\"hljs-name\" style=\"color: rgb(186, 98, 54);\">th<\/span>&gt;<\/span>Last name<span class=\"hljs-tag\" style=\"color: rgb(186, 98, 54);\">&lt;\/<span class=\"hljs-name\" style=\"color: rgb(186, 98, 54);\">th<\/span>&gt;<\/span>\r\n            <span class=\"hljs-tag\" style=\"color: rgb(186, 98, 54);\">&lt;<span class=\"hljs-name\" style=\"color: rgb(186, 98, 54);\">th<\/span>&gt;<\/span>Email<span class=\"hljs-tag\" style=\"color: rgb(186, 98, 54);\">&lt;\/<span class=\"hljs-name\" style=\"color: rgb(186, 98, 54);\">th<\/span>&gt;<\/span>\r\n            <span class=\"hljs-tag\" style=\"color: rgb(186, 98, 54);\">&lt;<span class=\"hljs-name\" style=\"color: rgb(186, 98, 54);\">th<\/span>&gt;<\/span>Gender<span class=\"hljs-tag\" style=\"color: rgb(186, 98, 54);\">&lt;\/<span class=\"hljs-name\" style=\"color: rgb(186, 98, 54);\">th<\/span>&gt;<\/span>\r\n            <span class=\"hljs-tag\" style=\"color: rgb(186, 98, 54);\">&lt;<span class=\"hljs-name\" style=\"color: rgb(186, 98, 54);\">th<\/span>&gt;<\/span>Country<span class=\"hljs-tag\" style=\"color: rgb(186, 98, 54);\">&lt;\/<span class=\"hljs-name\" style=\"color: rgb(186, 98, 54);\">th<\/span>&gt;<\/span>\r\n            <span class=\"hljs-tag\" style=\"color: rgb(186, 98, 54);\">&lt;<span class=\"hljs-name\" style=\"color: rgb(186, 98, 54);\">th<\/span>&gt;<\/span>Created<span class=\"hljs-tag\" style=\"color: rgb(186, 98, 54);\">&lt;\/<span class=\"hljs-name\" style=\"color: rgb(186, 98, 54);\">th<\/span>&gt;<\/span>\r\n            <span class=\"hljs-tag\" style=\"color: rgb(186, 98, 54);\">&lt;<span class=\"hljs-name\" style=\"color: rgb(186, 98, 54);\">th<\/span>&gt;<\/span>Status<span class=\"hljs-tag\" style=\"color: rgb(186, 98, 54);\">&lt;\/<span class=\"hljs-name\" style=\"color: rgb(186, 98, 54);\">th<\/span>&gt;<\/span>\r\n        <span class=\"hljs-tag\" style=\"color: rgb(186, 98, 54);\">&lt;\/<span class=\"hljs-name\" style=\"color: rgb(186, 98, 54);\">tr<\/span>&gt;<\/span>\r\n    <span class=\"hljs-tag\" style=\"color: rgb(186, 98, 54);\">&lt;\/<span class=\"hljs-name\" style=\"color: rgb(186, 98, 54);\">thead<\/span>&gt;<\/span>\r\n    <span class=\"hljs-tag\" style=\"color: rgb(186, 98, 54);\">&lt;<span class=\"hljs-name\" style=\"color: rgb(186, 98, 54);\">tfoot<\/span>&gt;<\/span>\r\n        <span class=\"hljs-tag\" style=\"color: rgb(186, 98, 54);\">&lt;<span class=\"hljs-name\" style=\"color: rgb(186, 98, 54);\">tr<\/span>&gt;<\/span>\r\n            <span class=\"hljs-tag\" style=\"color: rgb(186, 98, 54);\">&lt;<span class=\"hljs-name\" style=\"color: rgb(186, 98, 54);\">th<\/span>&gt;<\/span>First name<span class=\"hljs-tag\" style=\"color: rgb(186, 98, 54);\">&lt;\/<span class=\"hljs-name\" style=\"color: rgb(186, 98, 54);\">th<\/span>&gt;<\/span>\r\n            <span class=\"hljs-tag\" style=\"color: rgb(186, 98, 54);\">&lt;<span class=\"hljs-name\" style=\"color: rgb(186, 98, 54);\">th<\/span>&gt;<\/span>Last name<span class=\"hljs-tag\" style=\"color: rgb(186, 98, 54);\">&lt;\/<span class=\"hljs-name\" style=\"color: rgb(186, 98, 54);\">th<\/span>&gt;<\/span>\r\n            <span class=\"hljs-tag\" style=\"color: rgb(186, 98, 54);\">&lt;<span class=\"hljs-name\" style=\"color: rgb(186, 98, 54);\">th<\/span>&gt;<\/span>Email<span class=\"hljs-tag\" style=\"color: rgb(186, 98, 54);\">&lt;\/<span class=\"hljs-name\" style=\"color: rgb(186, 98, 54);\">th<\/span>&gt;<\/span>\r\n            <span class=\"hljs-tag\" style=\"color: rgb(186, 98, 54);\">&lt;<span class=\"hljs-name\" style=\"color: rgb(186, 98, 54);\">th<\/span>&gt;<\/span>Gender<span class=\"hljs-tag\" style=\"color: rgb(186, 98, 54);\">&lt;\/<span class=\"hljs-name\" style=\"color: rgb(186, 98, 54);\">th<\/span>&gt;<\/span>\r\n            <span class=\"hljs-tag\" style=\"color: rgb(186, 98, 54);\">&lt;<span class=\"hljs-name\" style=\"color: rgb(186, 98, 54);\">th<\/span>&gt;<\/span>Country<span class=\"hljs-tag\" style=\"color: rgb(186, 98, 54);\">&lt;\/<span class=\"hljs-name\" style=\"color: rgb(186, 98, 54);\">th<\/span>&gt;<\/span>\r\n            <span class=\"hljs-tag\" style=\"color: rgb(186, 98, 54);\">&lt;<span class=\"hljs-name\" style=\"color: rgb(186, 98, 54);\">th<\/span>&gt;<\/span>Created<span class=\"hljs-tag\" style=\"color: rgb(186, 98, 54);\">&lt;\/<span class=\"hljs-name\" style=\"color: rgb(186, 98, 54);\">th<\/span>&gt;<\/span>\r\n            <span class=\"hljs-tag\" style=\"color: rgb(186, 98, 54);\">&lt;<span class=\"hljs-name\" style=\"color: rgb(186, 98, 54);\">th<\/span>&gt;<\/span>Status<span class=\"hljs-tag\" style=\"color: rgb(186, 98, 54);\">&lt;\/<span class=\"hljs-name\" style=\"color: rgb(186, 98, 54);\">th<\/span>&gt;<\/span>\r\n        <span class=\"hljs-tag\" style=\"color: rgb(186, 98, 54);\">&lt;\/<span class=\"hljs-name\" style=\"color: rgb(186, 98, 54);\">tr<\/span>&gt;<\/span>\r\n    <span class=\"hljs-tag\" style=\"color: rgb(186, 98, 54);\">&lt;\/<span class=\"hljs-name\" style=\"color: rgb(186, 98, 54);\">tfoot<\/span>&gt;<\/span>\r\n<span class=\"hljs-tag\" style=\"color: rgb(186, 98, 54);\">&lt;\/<span class=\"hljs-name\" style=\"color: rgb(186, 98, 54);\">table<\/span>&gt;<\/span><\/pre>\n<p><b>jQuery Library:<\/b><br \/>\nInclude the jQuery library that helps to initialize DataTables with column filter inputs.<\/p>\n<pre style=\"color: rgb(95, 94, 78);\"><span class=\"hljs-tag\" style=\"color: rgb(186, 98, 54);\">&lt;<span class=\"hljs-name\" style=\"color: rgb(186, 98, 54);\">script<\/span> <span class=\"hljs-attr\">src<\/span>=<span class=\"hljs-string\" style=\"color: rgb(125, 151, 38);\">\"js\/jquery.min.js\"<\/span>&gt;<\/span><span class=\"undefined\"><\/span><span class=\"hljs-tag\" style=\"color: rgb(186, 98, 54);\">&lt;\/<span class=\"hljs-name\" style=\"color: rgb(186, 98, 54);\">script<\/span>&gt;<\/span><\/pre>\n<p><b>DataTables Library:<\/b><br \/>\nInclude the DataTables CSS and JS library files.<\/p>\n<pre style=\"color: rgb(95, 94, 78);\"><span class=\"hljs-tag\" style=\"color: rgb(186, 98, 54);\">&lt;<span class=\"hljs-name\" style=\"color: rgb(186, 98, 54);\">link<\/span> <span class=\"hljs-attr\">rel<\/span>=<span class=\"hljs-string\" style=\"color: rgb(125, 151, 38);\">\"stylesheet\"<\/span> <span class=\"hljs-attr\">type<\/span>=<span class=\"hljs-string\" style=\"color: rgb(125, 151, 38);\">\"text\/css\"<\/span> <span class=\"hljs-attr\">href<\/span>=<span class=\"hljs-string\" style=\"color: rgb(125, 151, 38);\">\"DataTables\/datatables.min.css\"<\/span>\/&gt;<\/span>\r\n<span class=\"hljs-tag\" style=\"color: rgb(186, 98, 54);\">&lt;<span class=\"hljs-name\" style=\"color: rgb(186, 98, 54);\">script<\/span> <span class=\"hljs-attr\">type<\/span>=<span class=\"hljs-string\" style=\"color: rgb(125, 151, 38);\">\"text\/javascript\"<\/span> <span class=\"hljs-attr\">src<\/span>=<span class=\"hljs-string\" style=\"color: rgb(125, 151, 38);\">\"DataTables\/datatables.min.js\"<\/span>&gt;<\/span><span class=\"undefined\"><\/span><span class=\"hljs-tag\" style=\"color: rgb(186, 98, 54);\">&lt;\/<span class=\"hljs-name\" style=\"color: rgb(186, 98, 54);\">script<\/span>&gt;<\/span><\/pre>\n<p><b>Attach DataTables Plugin to HTML Table:<\/b><\/p>\n<ul>\n<li>Create a clone of the thead tr and append it to the thead section of the table.<\/li>\n<li>Initialize the DataTables API class using the <code>DataTable()<\/code> method and configure the table object.<\/li>\n<li>Enable the server-side processing by doing the following settings.\n<ul>\n<li>Set the <code>processing<\/code> option to true.<\/li>\n<li>Set the <code>serverSide<\/code> option to true.<\/li>\n<li>Specify the server-side script URL (<code>fetchData.php<\/code>) in the <code>ajax<\/code> option.<\/li>\n<\/ul>\n<\/li>\n<li>Use the <code>initComplete()<\/code> method to define the column filtering operations.\n<ul>\n<li>Set the header cell to contain the input elements for the search and filter column.<\/li>\n<li>Disable the search option for the Created (index count 5) and Status (index count 6) columns.<\/li>\n<li>Post the keyword to the server-side script along with the specific column reference on every search input keypress.<\/li>\n<li>Render filtered table data based on the search value using the <code>draw()<\/code> method of the DataTables object.<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<pre style=\"color: rgb(95, 94, 78);\"><span class=\"hljs-tag\" style=\"color: rgb(186, 98, 54);\">&lt;<span class=\"hljs-name\" style=\"color: rgb(186, 98, 54);\">script<\/span>&gt;<\/span>\r\n<span style=\"color: rgb(110, 107, 94);\">$(<span class=\"hljs-built_in\" style=\"color: rgb(182, 86, 17);\">document<\/span>).ready(<span class=\"hljs-function\"><span class=\"hljs-keyword\" style=\"color: rgb(184, 84, 212);\">function<\/span>(<span class=\"hljs-params\" style=\"color: rgb(182, 86, 17);\"><\/span>)<\/span>{\r\n    $(<span class=\"hljs-string\" style=\"color: rgb(96, 172, 57);\">'#memListTable thead tr'<\/span>)\r\n    .clone(<span class=\"hljs-literal\" style=\"color: rgb(182, 86, 17);\">true<\/span>)\r\n    .addClass(<span class=\"hljs-string\" style=\"color: rgb(96, 172, 57);\">'filters'<\/span>)\r\n    .appendTo(<span class=\"hljs-string\" style=\"color: rgb(96, 172, 57);\">'#memListTable thead'<\/span>);\r\n\r\n    <span class=\"hljs-comment\" style=\"color: rgb(125, 122, 104);\">\/\/ Initialize DataTables API object and configure table<\/span>\r\n    <span class=\"hljs-keyword\" style=\"color: rgb(184, 84, 212);\">var<\/span> table = $(<span class=\"hljs-string\" style=\"color: rgb(96, 172, 57);\">'#memListTable'<\/span>).DataTable({\r\n        orderCellsTop: <span class=\"hljs-literal\" style=\"color: rgb(182, 86, 17);\">true<\/span>,\r\n        fixedHeader: <span class=\"hljs-literal\" style=\"color: rgb(182, 86, 17);\">true<\/span>,\r\n        processing: <span class=\"hljs-literal\" style=\"color: rgb(182, 86, 17);\">true<\/span>,\r\n        serverSide: <span class=\"hljs-literal\" style=\"color: rgb(182, 86, 17);\">true<\/span>,\r\n        ajax: <span class=\"hljs-string\" style=\"color: rgb(96, 172, 57);\">\"fetchData.php\"<\/span>,\r\n        initComplete: <span class=\"hljs-function\"><span class=\"hljs-keyword\" style=\"color: rgb(184, 84, 212);\">function<\/span> (<span class=\"hljs-params\" style=\"color: rgb(182, 86, 17);\"><\/span>) <\/span>{\r\n            <span class=\"hljs-keyword\" style=\"color: rgb(184, 84, 212);\">var<\/span> api = <span class=\"hljs-keyword\" style=\"color: rgb(184, 84, 212);\">this<\/span>.api();\r\n\r\n            <span class=\"hljs-comment\" style=\"color: rgb(125, 122, 104);\">\/\/ For each column<\/span>\r\n            api\r\n            .columns()\r\n            .eq(<span class=\"hljs-number\" style=\"color: rgb(182, 86, 17);\">0<\/span>)\r\n            .each(<span class=\"hljs-function\"><span class=\"hljs-keyword\" style=\"color: rgb(184, 84, 212);\">function<\/span> (<span class=\"hljs-params\" style=\"color: rgb(182, 86, 17);\">colIdx<\/span>) <\/span>{\r\n                <span class=\"hljs-comment\" style=\"color: rgb(125, 122, 104);\">\/\/ Set the header cell to contain the input element<\/span>\r\n                <span class=\"hljs-keyword\" style=\"color: rgb(184, 84, 212);\">var<\/span> cell = $(<span class=\"hljs-string\" style=\"color: rgb(96, 172, 57);\">'.filters th'<\/span>).eq(\r\n                    $(api.column(colIdx).header()).index()\r\n                );\r\n                <span class=\"hljs-keyword\" style=\"color: rgb(184, 84, 212);\">var<\/span> title = $(cell).text();\r\n                \r\n                <span class=\"hljs-keyword\" style=\"color: rgb(184, 84, 212);\">if<\/span>(colIdx != <span class=\"hljs-number\" style=\"color: rgb(182, 86, 17);\">5<\/span> &amp;&amp; colIdx != <span class=\"hljs-number\" style=\"color: rgb(182, 86, 17);\">6<\/span>){\r\n                    $(cell).html(<span class=\"hljs-string\" style=\"color: rgb(96, 172, 57);\">'&lt;input type=\"text\" class=\"dt-input\" placeholder=\"'<\/span> + title + <span class=\"hljs-string\" style=\"color: rgb(96, 172, 57);\">'\" \/&gt;'<\/span>);\r\n                }<span class=\"hljs-keyword\" style=\"color: rgb(184, 84, 212);\">else<\/span>{\r\n                    $(cell).html(<span class=\"hljs-string\" style=\"color: rgb(96, 172, 57);\">''<\/span>);\r\n                }\r\n\r\n                <span class=\"hljs-comment\" style=\"color: rgb(125, 122, 104);\">\/\/ On every keypress in this input<\/span>\r\n                $(\r\n                    <span class=\"hljs-string\" style=\"color: rgb(96, 172, 57);\">'input'<\/span>,\r\n                    $(<span class=\"hljs-string\" style=\"color: rgb(96, 172, 57);\">'.filters th'<\/span>).eq($(api.column(colIdx).header()).index())\r\n                )\r\n                .on(<span class=\"hljs-string\" style=\"color: rgb(96, 172, 57);\">'keyup change'<\/span>, <span class=\"hljs-function\"><span class=\"hljs-keyword\" style=\"color: rgb(184, 84, 212);\">function<\/span> (<span class=\"hljs-params\" style=\"color: rgb(182, 86, 17);\">e<\/span>) <\/span>{\r\n                    api\r\n                    .column(colIdx)\r\n                    .search(\r\n                        <span class=\"hljs-keyword\" style=\"color: rgb(184, 84, 212);\">this<\/span>.value\r\n                    )\r\n                    .draw();\r\n                });\r\n            });\r\n        }\r\n    });\r\n});<\/span>    \r\n<span class=\"hljs-tag\" style=\"color: rgb(186, 98, 54);\">&lt;\/<span class=\"hljs-name\" style=\"color: rgb(186, 98, 54);\">script<\/span>&gt;<\/span><\/pre>\n<p>By default, the data is listed in ascending order of the first column (first_name). You can change the column to set the listing order.<\/p>\n<ul>\n<li>The below example code sets the Created column (index count 5) as listing order and lists in descending order. (This means the newest records will come first)<\/li>\n<\/ul>\n<pre style=\"color: rgb(110, 107, 94);\">order: {\r\n    idx: <span class=\"hljs-number\" style=\"color: rgb(182, 86, 17);\">5<\/span>,\r\n    dir: <span class=\"hljs-string\" style=\"color: rgb(96, 172, 57);\">'desc'<\/span>\r\n}<\/pre>\n<h2>Server-side Script to Fetch DataTables Data (fetchData.php)<\/h2>\n<p>The <code>fetchData.php<\/code> file performs server-side processing with column filter operations.<\/p>\n<ul>\n<li>Define database credentials (host, username, password, database name) in the $dbDetails variable.<\/li>\n<li>Define DB table name in $table variable and PRIMARY KEY in $primaryKey variable.<\/li>\n<li>To make the SQL query-building process more accessible, we will use the SSP class (<code>ssp.class.php<\/code>).<\/li>\n<li>The <code>simple()<\/code> function of the SSP class helps to fetch the member&#8217;s data from the database based on the mentioned columns using PHP and MySQL.<\/li>\n<li>The <code>formatter<\/code> parameter is used to modify the default format of the data returns for the column.<\/li>\n<\/ul>\n<pre><span style=\"color: #0000BB\">&lt;?php <br \/> <br \/><\/span><span style=\"color: #FF8000\">\/\/&nbsp;Database&nbsp;connection&nbsp;info <br \/><\/span><span style=\"color: #0000BB\">$dbDetails&nbsp;<\/span><span style=\"color: #007700\">=&nbsp;array( <br \/>&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #DD0000\">'host'&nbsp;<\/span><span style=\"color: #007700\">=&gt;&nbsp;<\/span><span style=\"color: #DD0000\">'localhost'<\/span><span style=\"color: #007700\">, <br \/>&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #DD0000\">'user'&nbsp;<\/span><span style=\"color: #007700\">=&gt;&nbsp;<\/span><span style=\"color: #DD0000\">'root'<\/span><span style=\"color: #007700\">, <br \/>&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #DD0000\">'pass'&nbsp;<\/span><span style=\"color: #007700\">=&gt;&nbsp;<\/span><span style=\"color: #DD0000\">'root'<\/span><span style=\"color: #007700\">, <br \/>&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #DD0000\">'db'&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #007700\">=&gt;&nbsp;<\/span><span style=\"color: #DD0000\">'codexworld_db' <br \/><\/span><span style=\"color: #007700\">); <br \/> <br \/><\/span><span style=\"color: #FF8000\">\/\/&nbsp;DB&nbsp;table&nbsp;to&nbsp;use <br \/><\/span><span style=\"color: #0000BB\">$table&nbsp;<\/span><span style=\"color: #007700\">=&nbsp;<\/span><span style=\"color: #DD0000\">'members'<\/span><span style=\"color: #007700\">; <br \/> <br \/><\/span><span style=\"color: #FF8000\">\/\/&nbsp;Table's&nbsp;primary&nbsp;key <br \/><\/span><span style=\"color: #0000BB\">$primaryKey&nbsp;<\/span><span style=\"color: #007700\">=&nbsp;<\/span><span style=\"color: #DD0000\">'id'<\/span><span style=\"color: #007700\">; <br \/> <br \/><\/span><span style=\"color: #FF8000\">\/\/&nbsp;Array&nbsp;of&nbsp;database&nbsp;columns&nbsp;which&nbsp;should&nbsp;be&nbsp;read&nbsp;and&nbsp;sent&nbsp;back&nbsp;to&nbsp;DataTables. <br \/>\/\/&nbsp;The&nbsp;`db`&nbsp;parameter&nbsp;represents&nbsp;the&nbsp;column&nbsp;name&nbsp;in&nbsp;the&nbsp;database.&nbsp; <br \/>\/\/&nbsp;The&nbsp;`dt`&nbsp;parameter&nbsp;represents&nbsp;the&nbsp;DataTables&nbsp;column&nbsp;identifier. <br \/><\/span><span style=\"color: #0000BB\">$columns&nbsp;<\/span><span style=\"color: #007700\">=&nbsp;array( <br \/>&nbsp;&nbsp;&nbsp;&nbsp;array(&nbsp;<\/span><span style=\"color: #DD0000\">'db'&nbsp;<\/span><span style=\"color: #007700\">=&gt;&nbsp;<\/span><span style=\"color: #DD0000\">'first_name'<\/span><span style=\"color: #007700\">,&nbsp;<\/span><span style=\"color: #DD0000\">'dt'&nbsp;<\/span><span style=\"color: #007700\">=&gt;&nbsp;<\/span><span style=\"color: #0000BB\">0&nbsp;<\/span><span style=\"color: #007700\">), <br \/>&nbsp;&nbsp;&nbsp;&nbsp;array(&nbsp;<\/span><span style=\"color: #DD0000\">'db'&nbsp;<\/span><span style=\"color: #007700\">=&gt;&nbsp;<\/span><span style=\"color: #DD0000\">'last_name'<\/span><span style=\"color: #007700\">,&nbsp;&nbsp;<\/span><span style=\"color: #DD0000\">'dt'&nbsp;<\/span><span style=\"color: #007700\">=&gt;&nbsp;<\/span><span style=\"color: #0000BB\">1&nbsp;<\/span><span style=\"color: #007700\">), <br \/>&nbsp;&nbsp;&nbsp;&nbsp;array(&nbsp;<\/span><span style=\"color: #DD0000\">'db'&nbsp;<\/span><span style=\"color: #007700\">=&gt;&nbsp;<\/span><span style=\"color: #DD0000\">'email'<\/span><span style=\"color: #007700\">,&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #DD0000\">'dt'&nbsp;<\/span><span style=\"color: #007700\">=&gt;&nbsp;<\/span><span style=\"color: #0000BB\">2&nbsp;<\/span><span style=\"color: #007700\">), <br \/>&nbsp;&nbsp;&nbsp;&nbsp;array(&nbsp;<\/span><span style=\"color: #DD0000\">'db'&nbsp;<\/span><span style=\"color: #007700\">=&gt;&nbsp;<\/span><span style=\"color: #DD0000\">'gender'<\/span><span style=\"color: #007700\">,&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #DD0000\">'dt'&nbsp;<\/span><span style=\"color: #007700\">=&gt;&nbsp;<\/span><span style=\"color: #0000BB\">3&nbsp;<\/span><span style=\"color: #007700\">), <br \/>&nbsp;&nbsp;&nbsp;&nbsp;array(&nbsp;<\/span><span style=\"color: #DD0000\">'db'&nbsp;<\/span><span style=\"color: #007700\">=&gt;&nbsp;<\/span><span style=\"color: #DD0000\">'country'<\/span><span style=\"color: #007700\">,&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #DD0000\">'dt'&nbsp;<\/span><span style=\"color: #007700\">=&gt;&nbsp;<\/span><span style=\"color: #0000BB\">4&nbsp;<\/span><span style=\"color: #007700\">), <br \/>&nbsp;&nbsp;&nbsp;&nbsp;array( <br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #DD0000\">'db'&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #007700\">=&gt;&nbsp;<\/span><span style=\"color: #DD0000\">'created'<\/span><span style=\"color: #007700\">, <br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #DD0000\">'dt'&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #007700\">=&gt;&nbsp;<\/span><span style=\"color: #0000BB\">5<\/span><span style=\"color: #007700\">, <br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #DD0000\">'formatter'&nbsp;<\/span><span style=\"color: #007700\">=&gt;&nbsp;function(&nbsp;<\/span><span style=\"color: #0000BB\">$d<\/span><span style=\"color: #007700\">,&nbsp;<\/span><span style=\"color: #0000BB\">$row&nbsp;<\/span><span style=\"color: #007700\">)&nbsp;{ <br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return&nbsp;<\/span><span style=\"color: #0000BB\">date<\/span><span style=\"color: #007700\">(&nbsp;<\/span><span style=\"color: #DD0000\">'jS&nbsp;M&nbsp;Y'<\/span><span style=\"color: #007700\">,&nbsp;<\/span><span style=\"color: #0000BB\">strtotime<\/span><span style=\"color: #007700\">(<\/span><span style=\"color: #0000BB\">$d<\/span><span style=\"color: #007700\">)); <br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;} <br \/>&nbsp;&nbsp;&nbsp;&nbsp;), <br \/>&nbsp;&nbsp;&nbsp;&nbsp;array( <br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #DD0000\">'db'&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #007700\">=&gt;&nbsp;<\/span><span style=\"color: #DD0000\">'status'<\/span><span style=\"color: #007700\">, <br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #DD0000\">'dt'&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #007700\">=&gt;&nbsp;<\/span><span style=\"color: #0000BB\">6<\/span><span style=\"color: #007700\">, <br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #DD0000\">'formatter'&nbsp;<\/span><span style=\"color: #007700\">=&gt;&nbsp;function(&nbsp;<\/span><span style=\"color: #0000BB\">$d<\/span><span style=\"color: #007700\">,&nbsp;<\/span><span style=\"color: #0000BB\">$row&nbsp;<\/span><span style=\"color: #007700\">)&nbsp;{ <br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return&nbsp;(<\/span><span style=\"color: #0000BB\">$d&nbsp;<\/span><span style=\"color: #007700\">==&nbsp;<\/span><span style=\"color: #0000BB\">1<\/span><span style=\"color: #007700\">)?<\/span><span style=\"color: #DD0000\">'Active'<\/span><span style=\"color: #007700\">:<\/span><span style=\"color: #DD0000\">'Inactive'<\/span><span style=\"color: #007700\">; <br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;} <br \/>&nbsp;&nbsp;&nbsp;&nbsp;), <br \/>); <br \/> <br \/><\/span><span style=\"color: #FF8000\">\/\/&nbsp;Include&nbsp;SQL&nbsp;query&nbsp;processing&nbsp;class <br \/><\/span><span style=\"color: #007700\">require&nbsp;<\/span><span style=\"color: #DD0000\">'ssp.class.php'<\/span><span style=\"color: #007700\">; <br \/> <br \/><\/span><span style=\"color: #FF8000\">\/\/&nbsp;Output&nbsp;data&nbsp;as&nbsp;json&nbsp;format <br \/><\/span><span style=\"color: #007700\">echo&nbsp;<\/span><span style=\"color: #0000BB\">json_encode<\/span><span style=\"color: #007700\">( <br \/>&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #0000BB\">SSP<\/span><span style=\"color: #007700\">::<\/span><span style=\"color: #0000BB\">simple<\/span><span style=\"color: #007700\">(&nbsp;<\/span><span style=\"color: #0000BB\">$_GET<\/span><span style=\"color: #007700\">,&nbsp;<\/span><span style=\"color: #0000BB\">$dbDetails<\/span><span style=\"color: #007700\">,&nbsp;<\/span><span style=\"color: #0000BB\">$table<\/span><span style=\"color: #007700\">,&nbsp;<\/span><span style=\"color: #0000BB\">$primaryKey<\/span><span style=\"color: #007700\">,&nbsp;<\/span><span style=\"color: #0000BB\">$columns&nbsp;<\/span><span style=\"color: #007700\">) <br \/>); <br \/> <br \/><\/span><span style=\"color: #0000BB\">?&gt;<\/span><\/pre>\n<h2>SSP Library<\/h2>\n<p>The SSP class handles the database-related operations. It contains some helper functions to build SQL queries for DataTables server-side processing with custom links or buttons. You can see the code of the SSP library <a href=\"https:\/\/github.com\/codexworld\/DataTables-Column-Filtering-with-Server-side-Processing\/blob\/master\/ssp.class.php\" target=\"_blank\" rel=\"noopener\">here<\/a>.<\/p>\n<p><span class=\"note\">Note that:<\/span> This library and all the required files are included in the source code, you don&#8217;t need to download them separately.<\/p>\n<p class=\"seeAlso\"><span><\/span><a href=\"https:\/\/www.codexworld.com\/datatables-server-side-processing-custom-search-filter-with-php-mysql\/\">Add Custom Search and Filter to DataTables Server-side Processing with PHP<\/a><\/span><\/p>\n<h2>Conclusion<\/h2>\n<p>Our example code helps to display records in tabular format with advanced features using the DataTables library. Column search and filter functionality takes an important role in enhancing the table with DataTables. DataTables server-side processing feature can be used to add search options in the table columns and filter records from the database using PHP and MySQL. You can easily enhance the DataTables column filtering functionality with server-side processing.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>DataTables is a JavaScript library used to enhance the functionality and add advanced features to HTML tables. The DataTables plugin converts a basic HTML table into an advanced feature-rich table instantly. There are various advanced <\/p>\n","protected":false},"author":1,"featured_media":5569,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[4],"tags":[320,209,19,14,211],"class_list":["post-5567","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-php","tag-datatables","tag-filter","tag-mysql","tag-php","tag-search","cat-4-id","has_thumb"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.4 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>DataTables Column Filtering with Server-side Processing using PHP - CodexWorld<\/title>\n<meta name=\"description\" content=\"Datatables column filtering with server-side processing - Integrate column search and filter functionality in DataTables with PHP and MySQL. Add filter option to columns in DataTables with Ajax using PHP.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.codexworld.com\/datatables-column-filtering-with-server-side-processing-using-php\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"DataTables Column Filtering with Server-side Processing using PHP - CodexWorld\" \/>\n<meta property=\"og:description\" content=\"Datatables column filtering with server-side processing - Integrate column search and filter functionality in DataTables with PHP and MySQL. Add filter option to columns in DataTables with Ajax using PHP.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.codexworld.com\/datatables-column-filtering-with-server-side-processing-using-php\/\" \/>\n<meta property=\"og:site_name\" content=\"CodexWorld\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/codexworld\" \/>\n<meta property=\"article:author\" content=\"https:\/\/www.facebook.com\/codexworld\" \/>\n<meta property=\"article:published_time\" content=\"2024-03-07T06:05:59+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-08-16T04:20:56+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.codexworld.com\/wp-content\/uploads\/2024\/03\/datatables-column-filtering-with-server-side-processing-using-php-mysql-codexworld.png\" \/>\n\t<meta property=\"og:image:width\" content=\"1920\" \/>\n\t<meta property=\"og:image:height\" content=\"1080\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"CodexWorld\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@codexworldblog\" \/>\n<meta name=\"twitter:site\" content=\"@codexworldweb\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"CodexWorld\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"4 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/datatables-column-filtering-with-server-side-processing-using-php\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/datatables-column-filtering-with-server-side-processing-using-php\\\/\"},\"author\":{\"name\":\"CodexWorld\",\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/#\\\/schema\\\/person\\\/9da51d8fa3cdefeb5ec9c69136d4baf0\"},\"headline\":\"DataTables Column Filtering with Server-side Processing using PHP\",\"datePublished\":\"2024-03-07T06:05:59+00:00\",\"dateModified\":\"2025-08-16T04:20:56+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/datatables-column-filtering-with-server-side-processing-using-php\\\/\"},\"wordCount\":768,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/datatables-column-filtering-with-server-side-processing-using-php\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.codexworld.com\\\/wp-content\\\/uploads\\\/2024\\\/03\\\/datatables-column-filtering-with-server-side-processing-using-php-mysql-codexworld.png\",\"keywords\":[\"DataTables\",\"Filter\",\"MySQL\",\"PHP\",\"Search\"],\"articleSection\":[\"PHP\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.codexworld.com\\\/datatables-column-filtering-with-server-side-processing-using-php\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/datatables-column-filtering-with-server-side-processing-using-php\\\/\",\"url\":\"https:\\\/\\\/www.codexworld.com\\\/datatables-column-filtering-with-server-side-processing-using-php\\\/\",\"name\":\"DataTables Column Filtering with Server-side Processing using PHP - CodexWorld\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/datatables-column-filtering-with-server-side-processing-using-php\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/datatables-column-filtering-with-server-side-processing-using-php\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.codexworld.com\\\/wp-content\\\/uploads\\\/2024\\\/03\\\/datatables-column-filtering-with-server-side-processing-using-php-mysql-codexworld.png\",\"datePublished\":\"2024-03-07T06:05:59+00:00\",\"dateModified\":\"2025-08-16T04:20:56+00:00\",\"description\":\"Datatables column filtering with server-side processing - Integrate column search and filter functionality in DataTables with PHP and MySQL. Add filter option to columns in DataTables with Ajax using PHP.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/datatables-column-filtering-with-server-side-processing-using-php\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.codexworld.com\\\/datatables-column-filtering-with-server-side-processing-using-php\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/datatables-column-filtering-with-server-side-processing-using-php\\\/#primaryimage\",\"url\":\"https:\\\/\\\/www.codexworld.com\\\/wp-content\\\/uploads\\\/2024\\\/03\\\/datatables-column-filtering-with-server-side-processing-using-php-mysql-codexworld.png\",\"contentUrl\":\"https:\\\/\\\/www.codexworld.com\\\/wp-content\\\/uploads\\\/2024\\\/03\\\/datatables-column-filtering-with-server-side-processing-using-php-mysql-codexworld.png\",\"width\":1920,\"height\":1080,\"caption\":\"datatables-column-filtering-with-server-side-processing-using-php-mysql-codexworld\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/datatables-column-filtering-with-server-side-processing-using-php\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.codexworld.com\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"DataTables Column Filtering with Server-side Processing using PHP\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/#website\",\"url\":\"https:\\\/\\\/www.codexworld.com\\\/\",\"name\":\"CodexWorld\",\"description\":\"Web &amp; Mobile App Development Company\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.codexworld.com\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/#organization\",\"name\":\"CodexWorld\",\"url\":\"https:\\\/\\\/www.codexworld.com\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/www.codexworld.com\\\/wp-content\\\/uploads\\\/2014\\\/09\\\/codexworld-logo.png\",\"contentUrl\":\"https:\\\/\\\/www.codexworld.com\\\/wp-content\\\/uploads\\\/2014\\\/09\\\/codexworld-logo.png\",\"width\":200,\"height\":19,\"caption\":\"CodexWorld\"},\"image\":{\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/#\\\/schema\\\/logo\\\/image\\\/\"},\"sameAs\":[\"https:\\\/\\\/www.facebook.com\\\/codexworld\",\"https:\\\/\\\/x.com\\\/codexworldweb\",\"https:\\\/\\\/www.linkedin.com\\\/company\\\/codexworld\",\"https:\\\/\\\/www.youtube.com\\\/codexworld\"]},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/#\\\/schema\\\/person\\\/9da51d8fa3cdefeb5ec9c69136d4baf0\",\"name\":\"CodexWorld\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/cf4999db3b409de559f80677afa01729bb2eeda19be273c254e8b2c22729e386?s=96&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/cf4999db3b409de559f80677afa01729bb2eeda19be273c254e8b2c22729e386?s=96&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/cf4999db3b409de559f80677afa01729bb2eeda19be273c254e8b2c22729e386?s=96&r=g\",\"caption\":\"CodexWorld\"},\"description\":\"CodexWorld is a programming blog, one-stop destination for web professionals \u2014 developers, programmers, freelancers, and site owners.\",\"sameAs\":[\"http:\\\/\\\/www.codexworld.com\",\"https:\\\/\\\/www.facebook.com\\\/codexworld\",\"https:\\\/\\\/x.com\\\/codexworldblog\"],\"url\":\"https:\\\/\\\/www.codexworld.com\\\/author\\\/nitya192265\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"DataTables Column Filtering with Server-side Processing using PHP - CodexWorld","description":"Datatables column filtering with server-side processing - Integrate column search and filter functionality in DataTables with PHP and MySQL. Add filter option to columns in DataTables with Ajax using PHP.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.codexworld.com\/datatables-column-filtering-with-server-side-processing-using-php\/","og_locale":"en_US","og_type":"article","og_title":"DataTables Column Filtering with Server-side Processing using PHP - CodexWorld","og_description":"Datatables column filtering with server-side processing - Integrate column search and filter functionality in DataTables with PHP and MySQL. Add filter option to columns in DataTables with Ajax using PHP.","og_url":"https:\/\/www.codexworld.com\/datatables-column-filtering-with-server-side-processing-using-php\/","og_site_name":"CodexWorld","article_publisher":"https:\/\/www.facebook.com\/codexworld","article_author":"https:\/\/www.facebook.com\/codexworld","article_published_time":"2024-03-07T06:05:59+00:00","article_modified_time":"2025-08-16T04:20:56+00:00","og_image":[{"width":1920,"height":1080,"url":"https:\/\/www.codexworld.com\/wp-content\/uploads\/2024\/03\/datatables-column-filtering-with-server-side-processing-using-php-mysql-codexworld.png","type":"image\/png"}],"author":"CodexWorld","twitter_card":"summary_large_image","twitter_creator":"@codexworldblog","twitter_site":"@codexworldweb","twitter_misc":{"Written by":"CodexWorld","Est. reading time":"4 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.codexworld.com\/datatables-column-filtering-with-server-side-processing-using-php\/#article","isPartOf":{"@id":"https:\/\/www.codexworld.com\/datatables-column-filtering-with-server-side-processing-using-php\/"},"author":{"name":"CodexWorld","@id":"https:\/\/www.codexworld.com\/#\/schema\/person\/9da51d8fa3cdefeb5ec9c69136d4baf0"},"headline":"DataTables Column Filtering with Server-side Processing using PHP","datePublished":"2024-03-07T06:05:59+00:00","dateModified":"2025-08-16T04:20:56+00:00","mainEntityOfPage":{"@id":"https:\/\/www.codexworld.com\/datatables-column-filtering-with-server-side-processing-using-php\/"},"wordCount":768,"commentCount":0,"publisher":{"@id":"https:\/\/www.codexworld.com\/#organization"},"image":{"@id":"https:\/\/www.codexworld.com\/datatables-column-filtering-with-server-side-processing-using-php\/#primaryimage"},"thumbnailUrl":"https:\/\/www.codexworld.com\/wp-content\/uploads\/2024\/03\/datatables-column-filtering-with-server-side-processing-using-php-mysql-codexworld.png","keywords":["DataTables","Filter","MySQL","PHP","Search"],"articleSection":["PHP"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.codexworld.com\/datatables-column-filtering-with-server-side-processing-using-php\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.codexworld.com\/datatables-column-filtering-with-server-side-processing-using-php\/","url":"https:\/\/www.codexworld.com\/datatables-column-filtering-with-server-side-processing-using-php\/","name":"DataTables Column Filtering with Server-side Processing using PHP - CodexWorld","isPartOf":{"@id":"https:\/\/www.codexworld.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.codexworld.com\/datatables-column-filtering-with-server-side-processing-using-php\/#primaryimage"},"image":{"@id":"https:\/\/www.codexworld.com\/datatables-column-filtering-with-server-side-processing-using-php\/#primaryimage"},"thumbnailUrl":"https:\/\/www.codexworld.com\/wp-content\/uploads\/2024\/03\/datatables-column-filtering-with-server-side-processing-using-php-mysql-codexworld.png","datePublished":"2024-03-07T06:05:59+00:00","dateModified":"2025-08-16T04:20:56+00:00","description":"Datatables column filtering with server-side processing - Integrate column search and filter functionality in DataTables with PHP and MySQL. Add filter option to columns in DataTables with Ajax using PHP.","breadcrumb":{"@id":"https:\/\/www.codexworld.com\/datatables-column-filtering-with-server-side-processing-using-php\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.codexworld.com\/datatables-column-filtering-with-server-side-processing-using-php\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.codexworld.com\/datatables-column-filtering-with-server-side-processing-using-php\/#primaryimage","url":"https:\/\/www.codexworld.com\/wp-content\/uploads\/2024\/03\/datatables-column-filtering-with-server-side-processing-using-php-mysql-codexworld.png","contentUrl":"https:\/\/www.codexworld.com\/wp-content\/uploads\/2024\/03\/datatables-column-filtering-with-server-side-processing-using-php-mysql-codexworld.png","width":1920,"height":1080,"caption":"datatables-column-filtering-with-server-side-processing-using-php-mysql-codexworld"},{"@type":"BreadcrumbList","@id":"https:\/\/www.codexworld.com\/datatables-column-filtering-with-server-side-processing-using-php\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.codexworld.com\/"},{"@type":"ListItem","position":2,"name":"DataTables Column Filtering with Server-side Processing using PHP"}]},{"@type":"WebSite","@id":"https:\/\/www.codexworld.com\/#website","url":"https:\/\/www.codexworld.com\/","name":"CodexWorld","description":"Web &amp; Mobile App Development Company","publisher":{"@id":"https:\/\/www.codexworld.com\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.codexworld.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.codexworld.com\/#organization","name":"CodexWorld","url":"https:\/\/www.codexworld.com\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.codexworld.com\/#\/schema\/logo\/image\/","url":"https:\/\/www.codexworld.com\/wp-content\/uploads\/2014\/09\/codexworld-logo.png","contentUrl":"https:\/\/www.codexworld.com\/wp-content\/uploads\/2014\/09\/codexworld-logo.png","width":200,"height":19,"caption":"CodexWorld"},"image":{"@id":"https:\/\/www.codexworld.com\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/codexworld","https:\/\/x.com\/codexworldweb","https:\/\/www.linkedin.com\/company\/codexworld","https:\/\/www.youtube.com\/codexworld"]},{"@type":"Person","@id":"https:\/\/www.codexworld.com\/#\/schema\/person\/9da51d8fa3cdefeb5ec9c69136d4baf0","name":"CodexWorld","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/cf4999db3b409de559f80677afa01729bb2eeda19be273c254e8b2c22729e386?s=96&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/cf4999db3b409de559f80677afa01729bb2eeda19be273c254e8b2c22729e386?s=96&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/cf4999db3b409de559f80677afa01729bb2eeda19be273c254e8b2c22729e386?s=96&r=g","caption":"CodexWorld"},"description":"CodexWorld is a programming blog, one-stop destination for web professionals \u2014 developers, programmers, freelancers, and site owners.","sameAs":["http:\/\/www.codexworld.com","https:\/\/www.facebook.com\/codexworld","https:\/\/x.com\/codexworldblog"],"url":"https:\/\/www.codexworld.com\/author\/nitya192265\/"}]}},"jetpack_publicize_connections":[],"jetpack_featured_media_url":"https:\/\/www.codexworld.com\/wp-content\/uploads\/2024\/03\/datatables-column-filtering-with-server-side-processing-using-php-mysql-codexworld.png","jetpack_shortlink":"https:\/\/wp.me\/p6bxIh-1rN","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/www.codexworld.com\/wp-json\/wp\/v2\/posts\/5567","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.codexworld.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.codexworld.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.codexworld.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.codexworld.com\/wp-json\/wp\/v2\/comments?post=5567"}],"version-history":[{"count":3,"href":"https:\/\/www.codexworld.com\/wp-json\/wp\/v2\/posts\/5567\/revisions"}],"predecessor-version":[{"id":5861,"href":"https:\/\/www.codexworld.com\/wp-json\/wp\/v2\/posts\/5567\/revisions\/5861"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.codexworld.com\/wp-json\/wp\/v2\/media\/5569"}],"wp:attachment":[{"href":"https:\/\/www.codexworld.com\/wp-json\/wp\/v2\/media?parent=5567"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.codexworld.com\/wp-json\/wp\/v2\/categories?post=5567"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.codexworld.com\/wp-json\/wp\/v2\/tags?post=5567"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}