2 tables 1 json
2 tables 1 json
ZMUSIK95
Posts: 5Questions: 0Answers: 0
I have a table that uses server side processing, what I want to do is get results from two different tables in the same json.
My actual code is it:
$table = 'marcas';
$primaryKey = 'id';
$columns = array(
array('db' => 'nombre', 'dt' => 0),
array('db' => 'id', 'dt' => 1),
array('db' => 'id', 'dt' => 2)
);
// SQL server connection information
$sql_details = array(
'user' => 'root',
'pass' => '',
'db' => 'zdata',
'host' => 'localhost'
);
require( '../../app/plugins/dataTables/ssp.class.php' );
echo json_encode(
SSP::simple( $_GET, $sql_details, $table, $primaryKey, $columns )
);
This discussion has been closed.
Replies
that is going to be hard to do if both tables are serverSide:true. You hare going to have issues keeping paging, etc in sync. You page on table 1 to get the data for table 1 and two, then page on table two page and get data for both tables?
What I want to do is get data from two tables in the database and then display that data in a single table with the dataTables plugin using server side processing
ah, so an inner our outer join on two tables with a foreign key relationship
Yes
That's not something that the demo SSP script will do I'm afraid. You'd either need to modify that script, or perhaps have a look at the modifications that others have done - see for example here.
Allan