I have a mysql table that store all info about customer supports like smsPanel,website,vmodule,.....
customerName|smspanel|SMSstartDay|SMSexpDay |websit|WebStartDay|webExpDay|
------------------------------------------------------------
john |yes |2019/01/15 |2020/01/15|yes |2019/02/12 |2020/02/12
I am using datatable serverside method to show informations. Its ok when I show every single row of database in single row of data table. but i want to show every support package in different row lik this
customerName | package | StartDay | EndDate
----------------------------------------------
jhon | SMS |2019/01/15 |2020/01/15
jhon | website |2019/02/12 |2020/02/12
this is my sql query for datatable serverSide
if($ssaction == "customerSupportlist"){
$table = <<<EOT
(
SELECT
*
FROM pdsupport
where customer_smsPack >0
) temp
EOT;
}
and i use this cod to format datatable but its useful for one row display
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 ),
);
}
I dont know how to modify this part to split the rows. OR by changing mysql query make a table that has my favorite structure