Datatables Individual column searching using PHP Ajax Jquery

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hello friends this is one more video tutorial on data tables with PHP Ajax query in this tutorial we have discussed how to search individual column data by using PHP with Ajax data tables is very useful plug-in for low data in tabular format on web page with features like searching table column sorting pagination and many more but if you want to filter any particular table column data then you have to write some extra code at back-end this plug-in has also provide this functionality by writing some line of code but here we have made this feature by writing some PHP code at the server side and you can make this type of feature very easily this thing's we will discuss in this video this is our testing database sent in this database we have to table like category and product in category table there is two column like category Aden category name and in product table there is four table column like head category name and price here category it is a primary key in category table and foreign key in product table in both table we have already inserted data in it so we will join both table and fetch data table and display on webpage and data tables we will filter data according category column so we can see particular category product data on web page without refresh of web page this is our index page and on this page first URL is for loans query library second URL is for load bootstrap stylesheet library third URL is for loads query data table JavaScript library fourth URL is for data tables bootstrap JavaScript library fifth is for load data tables bootstrap style sheet 6 QR l is for load bootstrap JavaScript library the sole URL is required for this video tutorial first we want the load product data on webpage in table format so we have to find one table with attributes it is equal to product data with three table heading like product add product name category and price we will load data under this table by using data table plugin here first we have defined select box with category list for filter data according to selection of category so we have right select tag with attribute name is equal to category it is equal to category in this tag we have defined one option tag with blank value under this first we want to fill this select box with category they've uh from category table so we have first mate database connection so we have right dollar Connect as equal to mislead connect function with four argument like hostname set to locale lost username set to root password set to blank and database name is set to testing one after making database we have right dollar query variable is equal to select star from category table order by category name in ascending order this query will fetch category table data now we want to execute this query so we have right dollar result variable is equal to miss Lee query function with two arguments like dollar connect variable and dollar query variable this function will execute query and store data and dollar result variable we have ride while loop and under this we have right dollar row variable is equal to misty fetch array function with dollar resolved variable this function will convert query result into a ray in store into dollar row variable under this while loop we have right echo statement and under text we have right option value is equal to dollar old category and under text we have right dollar old category name this way we have fill select box with category name and in value we have store category now we have moved to write query code for activate data tables plugin here first we have make load data function with is category argument under this argument we will pass category eight for load data according that category if we have not passed this argument then it will load all data on webpage this function will activate data tables plug-in on product data table and it will load data under this product data table under this function we have write data table variable is equal to table in product data with data table method this method will activate data table plug-in on table with abuser data under this method we have right first option processing set to true this option will enable the display of a processing indicator when the table is being processed in second option we have right server side set to true this option will switch client side processing to server side processing in third option we have right order set to blank array this option will enable table column ordering lastly we have right Ajax option by using this option we can send Ajax request the server and in this first we have right first option URLs set to fetch dot PHP here we have send requested to this page in second option we have right type set to post method here we have used post method for send data to server in third option we have write data here we can define which data we want send to server so here we have write as category argument this way we have set all option for low data under product data table by using data tables plugin after this we want the disabled table sorting of category call them so here we have right column definition option and under this we have right targets option set with column number two and orderable option set to false this way we have disabled category table column now we have moved to write PHP code on fetch dot PHP page and on this page first we have make database connections so here we have right dollar connect variable is equal to mystically connect function with 4 argument like hostname set the locale lost username set to root password set to blank and database name set to testing 1 after making database connection now we have defined all or columns variable in this variable we will store table column name and array format so here we have right column name product dotted product dot name category dot category name and product dot price and array format now we have right dollar query variable is equal to select star from product table within a join category on category dog category it is equal to product category after this we have a gain right dollar query variable and in this variable we have AB and where clause below this we have right if statement and in condition we have right is set function with dollar post search value variable here this post search value variable has been passed by data table plugin when we have write something in search box and then it will execute if block so under this block we have right dollar query variable and this variable we have a vent query like table column order like percentage dollar post search value variable percentage same query we have right for all table column this query will search data in all table column after the findings to we have a gain right if statement and condition we have right is set function with dollar post-order variable this condition will check if this variable value is set then it will execute if block otherwise it will execute else block here when we have clicked on table for sort table column then this dollar post-order variable has been passed by data tables query plugin for sort data according to particular column in ascending or descending order supposed dollar post-order variable value is said then it will execute if block and under this we have right dollar query variable and this variable we have a BEM query like order by dollar columns variable with dollar post-order zero column variable and dollar post order zero Direction variable but supposed dollar post-order variable value is not set then it will execute tells block and under this block we have right dollar query variable and in this variable we have a vent query like order by product dotted table column in descending order now we have defined one dollar query one variable is equal to blank and this variable we will store a query with fetch limit data then after we have write of statement and under condition we have write dollar post length variable value is not equal to minus 1 this condition will check if Dollar post Lankes variable value is not equal to minus 1 then we'll execute if block of code so under this block we have right dollar query one variable is equal to limit dollar post start variable comma dollar post length variable here both variable has been post by data tables plugin by Ajax request here we have store query and two different variable from dollar query variable we will get number of filter data and from combination of both query we will make complete query for fetch data from order table first we want to execute only dollar query variable query forget number of filter record so we have write dollar number of filter row is equal to miss clean on rows function and under this we have write mystically query function with dollar connect variable and dollar query variable here miss CLE query function execute dollar query variable and miss clean am rows function return number of rows from query execution and store into dollar number filter rows variable now we want to execute complete queries so we have write dollar result variable is equal to miss Lee query function with two arguments like dollar connect variable and dollar query variable concatenate dollar query one variable here we have combined query of both variable and dismissal a query function will execute combined query and store result in dollar result variable now we have write dollar data variable is equal to blank array and this variable we will store dollar resolved data one by one for fast data from dollar resolved variable we have use while loop would condition like dollar row variable is equal to miss CLE fetch array function with dollar resolve variable this function will convert dollar resolved data into a rayon store into dollar row variable to this while loop first we have create $1 sub or a variable is equal to blank array in this variable we will store data get from dollar o variable first we want to store product in column data so we have right dollar sabor a variable is equal to dollar row at table column name after this we want to store product name column data so we have right dollar sabor a variable is equal to dollar o named table column name then after four store category names so we have right dollar sabor a variable is equal to dollar old category named table column and lastly we want the store product price theta so we have right dollar sabor a variable is equal to dollar roll price table column name so here we have store data and dollar sabor a variable now we have right dollar data variable is equal to dollars sub or a variable so here we have store all salary data and dollar data variable now we want to get total number of rows in product table so we have create function get all data with dal or connect variable argument this function will return number of rows in table under this function we have right dollar query variable is equal to select star from product table after this we want to execute the above queries so we have right dollar result variable is equal to mystical a query function with two arguments like dollar connect variable and dollar query variable this function will execute query and store result into dollar result variable now we want to get number of rows so we have right return statement with Miss clean Ambrose function with dollar resolve variable this function will return number of rows from dollar resolve variable now we have right dollar output variable is equal to a R and in this array we have right first key draw with value dollar pose draw variable and second key we have right records total and in value we have right get all data function with dollar connect the bulb in third key we have right records filtered in this key value we have right dollar number filter rule variable in which we have store a number of filter rows and in last key we have right data and then value we have right dollar data variable in which we have store order data and array format so this way we have store all required data from a table and dollar output variable want to send us data to fetch data function Ajax requests in JSON format so we have right echo statement with JSON encode function and in this function we have right dollar output variable now we have go-to index page and here we have called low data function without any argument this function will load product data on webpage now we have checked output in browser friends you can see when page has been loaded browser than it has load product and category data on webpage in table format with data tables functionality like searching pagination paging display number of records per page and many more here you can see in category table column we can see category list and select box so when we have select any particular category then we want to get that category product data in this table on webpage now we want to write query code for this things so here when we have select any category then table data should be load according selected category so here we have right dollar with document selector with unmet recovery ventilation category so when we have select any category then this code will execute under this first we want to get category yet so we have write category variable is equal to dollar this with value method this method will return category eight of selected category and store into this category variable now we cannot directly load data and data table first we want to destroy table then after we can load data so for destroy we have write table lid product data with data table method and with this method we have write destroy method so this method will destroy table data after destroying of data table now we want to load product data of selected category so first we want to check category variable has some value so we have write of statement and under condition we have write category variable value is not equal to blank if category variable is not blank then that will execute if block of code and under this block we have called low data function with category argument this function will load product data according to selected category that means it will load only select category data not all product table data but suppose category variable value is blank then it will execute tells block of code so here we have not select any category that means we want to load all product data so we have directly called load data function without any argument this function will load all product data now we have moved to write PHP code for load product data for selected category so here we have write a statement and under condition we have write as set function with dollar post as category variable pass from data table method condition will check if dollar post is category variable value is set then it will execute if block of code and under this block we have right dollar query variable and in this variable we have a parent text like product category is equal to dollar post is category variable this way we have a bent query according to category filter and it below data according to value of selected category now our code is ready so we have saved this code unchecked output and browser friends first we have repressed this page and now we can see product data on webpage in tabular format now we want to get only mobile category they are on webpage so here we have select mobile category after selecting of mobile category we have got only mobile category they on web page without refresh of web page but now we want to get all data so we have select first option after selecting first option we have got all product data on web page without refresh of web page this way we can filter table data according to selection from select box and after select particular data have golf data according to select box selection you can make this type of filter for all table column also here we have discussed only one table column filter you can do the stings with all column also this type of feature is very useful when you have large amount of data and you want to filter that data according particular query then you can also done with data table plugin so this is our simple video tutorial on how to fill their individual table column data and data table by using PHP script with ajax query if you have any query regarding this video tutorial please comment your query in comment box and if you like this video tutorial please share with your friends or even you can also share on social media also if you want to get more update regarding our video tutorial please subscribe our youtube channel forget more update regarding release of future video lastly keep watching our youtube channel thanks for watching this video tutorial
Info
Channel: Webslesson
Views: 78,254
Rating: undefined out of 5
Keywords: datatables with PHP, datatables individual column filter server side, jquery datatables individual column filtering example, datatables search specific column using php, jquery datatables column search with php, jquery datatable column filter examples, datatables custom search, jquery datatable column filter on top, jquery datatable column filter in header, datatable server side custom column search
Id: Ymvosj4JB3U
Channel Id: undefined
Length: 21min 19sec (1279 seconds)
Published: Thu Jul 13 2017
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.