I have a problem using this custom ssp file , I use jOIN statement then I saw this repository in GIT , then I try to follow it, then I already done with it but no output show. what's wrong with my code?
I forgot to indicate the source of this algorithm >> https://github.com/emran/ssp/blob/master/example/scripts/ssp.customized.class.php
UPDATE: I already get the DATA but the sorting,searching,pagination are not working. what do I need to do ?
$table = 'documentlog';
$primaryKey = 'logid';
$columns = array(
array( 'db' => '`a`.`ts`' ,'dt' => 0, 'field' => 'ts' ),
array( 'db' => '`d`.`barcodenumber`' ,'dt' => 1, 'field' => 'barcodenumber'),
array( 'db' => '`a`.`remarks`' ,'dt' => 2, 'field' => 'remarks' ),
array( 'db' => '`c`.`department`' ,'dt' => 3, 'field' => 'department' ),
array( 'db' => '`a`.`ts`' ,'dt' => 4, 'field' => 'ts', 'formatter' => function( $d, $row )
{
$date1 = date_create($d);
$date2 = date_create(date('Y-m-d H:i:s'));
$dd = date_diff($date1, $date2);
$diff = $dd->y."years,".$dd->m."months,".$dd->d."days";
return $diff;
})
);
$sql_details = array(
'user' => 'root',
'pass' => '',
'db' => 'db_name',
'host' => 'localhost'
);
require( 'ssp.php' ); (I rename the file to ssp.php)
$joinQuery = " FROM `documentlog` AS `a` INNER JOIN `sub_query` AS `b` ON (`b`.`docid` = `a`.`docid` AND `b`.`logid`=`a`.`logid` ) INNER JOIN `user` AS `c` ON (`c`.`uid` = `a`.`user` ) INNER JOIN `document` `d` ON (`d`.`id` = `a`.`docid`) ";
$extraWhere = " `c`.`department` = '".$sample."' AND `d`.`end` = 0";
echo json_encode(
SSP::simple( $_GET, $sql_details, $table, $primaryKey, $columns, $joinQuery, $extraWhere, $groupBy)
);
And my script is :
$(document).ready(function(){
var table = $('#tbl_doc_rec').DataTable({
"processing": true,
"serverSide": true,
"ajax" : {url:'back_end.php', type:'POST'},
});
});