External key in table

External key in table

pippuccio76pippuccio76 Posts: 19Questions: 10Answers: 0

Hi , sorry for english i have a datatable with some value tht are external key for example :

<th>N. </th>
<th>Driver</th> //id of external table
<th>Company</th>//id of external table
<th>Customer</th>//id of external table

in normal table (without server side processing) i do this

<?php $driver=$drivers->recupera_da_id($row['id_drivers']) ?>
<td> <?=$driver->username?></td>

<td>
<?php $company=$companies->recupera_da_id($row['id_company']); ?>
<?=$company->name ;?>

</td>

<td>
<?php $customer=$customers->recupera_da_id($row['id_customer']); ?>
<?=$customer->name ;?>

</td>

now in server side this is my culumns:

$columns = array(

array( 'db' => 'numero_corsa', 'dt' => 0 ),
array( 'db' => 'id_drivers',  'dt' => 1 ),
array( 'db' => 'id_company',   'dt' => 2 ),
array( 'db' => 'id_customer',     'dt' => 3 )

);

How can i show instead id_drivers $driver->username
instead id_company $company->name
instead id_customer $customer->name

Answers

  • allanallan Posts: 63,455Questions: 1Answers: 10,465 Site admin

    Several options:

    1. Modify the SSP class to support left join statements.
    2. Use the Editor PHP libraries which support a left join out of the box.
    3. Create a "VIEW" which encapsulates the join so you can just query the view
    4. Consider if you actually need server-side processing? Do you have tens of thousands or more rows in the table?

    Allan

This discussion has been closed.