Server-side processing and SQL WHERE parameters
Server-side processing and SQL WHERE parameters
Hello!
I'm trying out the server-side processing (http://datatables.net/release-datatables/examples/server_side/server_side.html). Or the PDO version to be specific (https://gist.github.com/jjb3rd/3156545). This works fine for simple SELECT type queries.
If I have understood things correctly so can I send parameters to the server-side with "fnServerParams" (http://datatables.net/release-datatables/examples/server_side/custom_vars.html). And I guess I can retrieve them with $_GET or $_POST in PHP?
However, my question is how to do a query with a WHERE section using your server side php code (first link). For example, if I have a page where I only want to load a table with info about the current user, how do I add that user ID into the query for server-side processing?
Or maybe that isn't possible, and I maybe have to add it as a column like this?
[code]
$aColumns = array( 'engine', 'browser', 'platform', 'version', 'grade', 'user_id' );[/code]
And then hide that column from being printed and filter by my id? (ie I get all rows from database, and then apply a filter).
Or is there another, better way?
I'm trying out the server-side processing (http://datatables.net/release-datatables/examples/server_side/server_side.html). Or the PDO version to be specific (https://gist.github.com/jjb3rd/3156545). This works fine for simple SELECT type queries.
If I have understood things correctly so can I send parameters to the server-side with "fnServerParams" (http://datatables.net/release-datatables/examples/server_side/custom_vars.html). And I guess I can retrieve them with $_GET or $_POST in PHP?
However, my question is how to do a query with a WHERE section using your server side php code (first link). For example, if I have a page where I only want to load a table with info about the current user, how do I add that user ID into the query for server-side processing?
Or maybe that isn't possible, and I maybe have to add it as a column like this?
[code]
$aColumns = array( 'engine', 'browser', 'platform', 'version', 'grade', 'user_id' );[/code]
And then hide that column from being printed and filter by my id? (ie I get all rows from database, and then apply a filter).
Or is there another, better way?
This discussion has been closed.