Where clause not working in data table server-side processing

送分小仙女□ 提交于 2021-02-11 12:36:11

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!