Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

jTables Filtering for PHP

Tags:

jquery

php

mysql

jTable (www.jtable.org) has great references to Filtering on its website, but its for ASP.NET. I require it to use for PHP, but sadly the documentation made no mention of the APIs for filtering except for the sample ASP.NET server side file.

Anyway, jTables uses:

//Re-load records when user click 'load records' button.
    $('#LoadRecordsButton').click(function (e) {
        e.preventDefault();
        $('#PeopleTableContainer').jtable('load', {
            Name: $('#Name').val(),
            Branch: $('#Branch').val()
        });
    });

I can see that I can pass values to the server using the Name and branch, but I don't know how to catch that on the PHP code so I can do a WHERE on my mysql code.

like image 853
marche Avatar asked Jul 21 '26 11:07

marche


1 Answers

//Load person list from server
$('#PeopleTableContainer').jtable('load', { Age: 78 });

//Get records from database
$result = mysql_query("SELECT * FROM people WHERE Age = '" . $_POST["Age"] . "';");
like image 82
Njoroge Avatar answered Jul 23 '26 00:07

Njoroge



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!