this is my query and it works well
SELECT companies.name as name,services.id as service_id , services.Companie_Fk as companieId,services.desc as desk from services INNER JOIN companies ON services.Companie_Fk =companies.id;
And it shows to me this output and that is right
This is my code for using the data table to show above results :
<?php
header('Access-Control-Allow-Origin: *');
$dbDetails = array(
'host' => 'localhost',
'user' => 'root',
'pass' => '',
'db' => 'adsl'
);
$table = 'services';
$primaryKey = 'id';
$columns = array( array( 'db' => 'desc', 'dt' => 0 ),array( 'db' => 'price', 'dt' => 1 ),
array(
'db' => 'id',
'dt' =>3,
'formatter' => function( $d, $row ) {
return '<a href="javascript:void(0)" class="btn btn-primary btn-edit" data-id="'.$row['id'].'"> ویرایش </a> <a href="javascript:void(0)" class="btn btn-danger btn-delete ml-2" data-id="'.$row['id'].'"> حذف </a>';
}
)
);
// Include SQL query processing class
require '../ssp.class.php';
// Output data as json format
echo json_encode(
SSP::simple( $_GET, $dbDetails, $table, $primaryKey, $columns ));
now , How can I adjust the columns to show the data according to above query?
i'm using ssp-class in this link :
