I am trying to implement a filter in jTable. Here is the jTable Filtering Demo.
I used the jQuery code supplied by the demo to sucessfully send POST data to the listAction php script. I access this data and assign it to the $filter variable. I also add two wildcards before and after the string to tell MySQL to perform a comprehensive search rather then an index search.
$filter = '%';
$filter .= $_POST['name'];
$filter .= '%';
$startIndex = $_GET['jtStartIndex'];
$pageSize = $_GET['jtPageSize'];
$sorting = $_GET['jtSorting'];
I then call the stored procedure and pass in each variable. I removed actual database and procedure name, but I verified they are correct.
$mysqli->query("USE data;");
$res = $mysqli->query("CALL proced($startIndex, $pageSize, $filter);");
$res returns false here.
Calling Stored Procedures DEFINITELY works as I have other functionalities working this way. I have other Stored Procedures working that simply return 0 to 9 records correctly. Here is the current Stored Procedure code:
CREATE DEFINER=`root`@`localhost` PROCEDURE `proced`(startIndex INTEGER, pageSize INTEGER, filter VARCHAR(255))
BEGIN
SELECT * FROM reports
WHERE `new`=0 AND ReportingName LIKE filter
ORDER BY idReports ASC
LIMIT startIndex, pageSize;
END
Passing in values in MySQL workbench works and the query returns the correct rows:
call proced(
0,
10,
'Art%'
);
But jTable fails with "An error occured while communicating to the server."
Can anyone point me in the right direction?