我有一个mysql表,用于存储有关客户支持的所有信息,例如smsPanel,网站,vmodule,.....
customerName|smspanel|SMSstartDay|SMSexpDay |websit|WebStartDay|webExpDay|
------------------------------------------------------------
john |yes |2019/01/15 |2020/01/15|yes |2019/02/12 |2020/02/12
我正在使用数据表服务器端方法来显示信息。当我在数据表的单行中显示数据库的每一行时,还可以。但是我想在不同的行中显示每个支持包
customerName | package | StartDay | EndDate
----------------------------------------------
jhon | SMS |2019/01/15 |2020/01/15
jhon | website |2019/02/12 |2020/02/12
这是我对数据表serverSide的sql查询
if($ssaction == "customerSupportlist"){
$table = <<<EOT
(
SELECT
*
FROM pdsupport
where customer_smsPack >0
) temp
EOT;
}
并且我使用此编码来格式化数据表,但它对于一行显示很有用
if($ssaction == "customerSupportlist"){
$primaryKey='id';
$columns = array(
array( 'db' => 'customer_fname','dt' => 0),
array( 'db' => 'customer_lname', 'dt' => 1 ),
array('db' => 'customer_ncode','dt' => 2),
array('db' => 'customer_mobile','dt' => 3),
array( 'db' => 'id',
'dt' => 4,
'formatter' =>function( $d, $row ) {
$customerPacks=getCustomerPacks($d);
return $customerPacks;
}
),
array( 'db' => 'id',
'dt' => 5,
'formatter' =>function( $d, $row ) {
$startDate=getCustomerPackStartDate($d);
return $startDate;
}
),
array( 'db' => 'id',
'dt' => 6,
'formatter' =>function( $d, $row ) {
$endDate=getCustomerPackEndDate($d);
return $endDate;
}
),
array( 'db' => 'id','dt' => 7 ),
);
}
我不知道如何修改此部分以拆分行。或者通过更改mysql查询来创建一个具有我最喜欢的结构的表