มีเคสปัญหา datatable คือ เนื่องจาก column ได้ถูกใช้งานในคำสั่ง if ไปหมดแล้ว
Code (PHP)
$data_sql = "SELECT * FROM `data` WHERE 1=1";
if( !empty($requestData['search']['value']) ) {
$data_sql.=" AND ( id_user LIKE '".$requestData['search']['value']."%' )";
}
if( !empty($requestData['columns'][0]['search']['value']) ){
$data_sql.=" AND ( id_user LIKE '%".$requestData['columns'][0]['search']['value']."%' )";
}
if( !empty($requestData['columns'][1]['search']['value']) ){
$data_sql.=" AND ( name LIKE '%".$requestData['columns'][1]['search']['value']."%' )";
}
if( !empty($requestData['columns'][2]['search']['value'])){
$data_sql.=" AND ( lastname LIKE '%".$requestData['columns'][2]['search']['value']."%' )";
}
if( !empty($requestData['columns'][4]['search']['value'])){
$data_sql.=" AND ( faculty LIKE '%".$requestData['columns'][4]['search']['value']."%' )";
}
if( !empty($requestData['columns'][6]['search']['value'])){
$data_sql.=" AND ( id_type LIKE '%".$requestData['columns'][6]['search']['value']."%' )";
}
if( !empty($requestData['columns'][5]['search']['value'])){
$data_sql.=" AND ( id_user LIKE '".$requestData['columns'][5]['search']['value']."%' )";
}