Server-side with multiple LEFT JOINs and additional WHERE clause solution (PHP)
Server-side with multiple LEFT JOINs and additional WHERE clause solution (PHP)
I recently needed to use server-side processing but my data structure required getting relational data from some additional tables. So I expanded some of the functions in the class to accomplish this. Here is the result:
https://github.com/lewsid/dinkly/blob/master/classes/core/base/BaseDinklyDataTables.php
I started with the ssp.class.php that comes with DataTables and added what I needed from there to accomplish the LEFT JOINs and additional where clause. While the class I linked to is in the DInkly framework, it should be fairly portable. Note that I removed the db() and sql_connect() functions as Dinkly already has a PDO database object available in the controller, but that could easily be added back in from the ssp.class.php file if needed.
I hope people find this example useful in their own implementations!
Replies
Nice one - thanks for sharing this with us! I'm sure others will find it useful.
Regards,
Allan