我在使用这个定制的ssp文件时遇到了问题,我使用了join语句,然后我在git中看到了这个存储库,然后我尝试跟踪它,然后我已经完成了它,但是没有输出显示。我的代码怎么了?
我忘了指出这个算法的来源>>https://github.com/emran/ssp/blob/master/example/scripts/ssp.customized.class.php
更新:我已经得到的数据,但排序,搜索,分页不工作。我需要做什么?
$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)
);
我的剧本是:
$(document).ready(function(){
var table = $('#tbl_doc_rec').DataTable({
"processing": true,
"serverSide": true,
"ajax" : {url:'back_end.php', type:'POST'},
});
});
暂无答案!
目前还没有任何答案,快来回答吧!