[SOLVED] Getting data for the datatables using WHERE statement then still allow filtering

[SOLVED] Getting data for the datatables using WHERE statement then still allow filtering

5ummer55ummer5 Posts: 2Questions: 0Answers: 0
edited April 2014 in DataTables 1.9
Hi all,

I am new to DataTables and I am trying to get some data to display. I want to only select data from the db WHERE field_name IS NOT NULL then be able to filter the results. How do I go about doing this. I have searched and searched but not found anything too helpful. By the way I am a noob so expect stupid questions! haha!

I have added the code below to the processing file:

$sWhereNew = "field_name IS NOT NULL ";

/*
* SQL queries
* Get data to display
*/
$sQuery = "
SELECT SQL_CALC_FOUND_ROWS `".str_replace(" , ", " ", implode("`, `", $aColumns))."`
FROM $sTable
WHERE $sWhereNew
$sWhere
$sOrder
$sLimit

This filters the results and shows at the bottom xxxx results filtered from xxxx but then I cannot use the search bar to filter further. What am I doing wrong?!

Thanks for any help!!

Replies

  • 5ummer55ummer5 Posts: 2Questions: 0Answers: 0
    Thank goodness for stack overflow and @mainguy!

    http://stackoverflow.com/questions/22823408/sql-and-datatables-returning-values-for-the-database
This discussion has been closed.