问题
I am using data table Server-side processing. I am getting the data from the database. My issue is, Where clause not working with Server-side processing. I am using the below code. I found one link on Stack overflow and I added the same code but that code is also not working.
I refer this link
How to use 'WHERE' clause using ssp.class.php DataTables
$sql_details = array(
'user' => 'root',
'pass' => '',
'db' => 'test',
'host' => 'localhost'
);
if($_REQUEST['action']=='admin'){
$table = 'tbl_admin';
$primaryKey = 'admin_id';
$columns = array(
array( 'db' => 'firstname', 'dt' => 0 ),
array( 'db' => 'lastname', 'dt' => 1 ),
array( 'db' => 'email', 'dt' => 2 ),
array( 'db' => 'date_of_created','dt' => 3,
'formatter' => function( $d, $row ) {
return date( 'd-m-Y', strtotime($d));
}
)
);
require 'datatables/ssp.class.php';
//$where = "is_active =1 order by DESC date_of_created"; //tried this
//$where = "is_active ='1'"; //tried this
$where = "is_active =1"; // tried this
echo json_encode(
SSP::simple( $_GET, $sql_details, $table, $primaryKey, $columns, null, $where )
);
}
Would help in out in this solution?
来源:https://stackoverflow.com/questions/63426594/where-clause-not-working-in-data-table-server-side-processing