How to do more than 1 question to database
How to do more than 1 question to database
I have the code below and its working fine. It gets data from client table so I can show it in the table.
The question is that I need to show the list of contracts that this client has (based on the dni I got from this query), on other table (called contratcs) on one field of that datatable.
I don´t know even where to start with this. Is this possible to do?
Thank you and Best Regards,
Paucharan
include( "/var/www/html/Editor-PHP-1.9.0/lib/DataTables.php" );
use
DataTables\Editor,
DataTables\Editor\Field,
DataTables\Editor\Format,
DataTables\Editor\Mjoin,
DataTables\Editor\Options,
DataTables\Editor\Upload,
DataTables\Editor\Validate,
DataTables\Editor\ValidateOptions;
Editor::inst( $db, 'client' )
->fields(
Field::inst( 'id' )->validator( 'Validate::numeric' ),
Field::inst( 'nombre' )->validator( 'Validate::notEmpty' ),
Field::inst( 'dni' )->validator( 'Validate::notEmpty' ),
Field::inst( 'tipoDoc' )->validator( 'Validate::notEmpty' ),
Field::inst( 'apellido1' )->validator( 'Validate::notEmpty' ),
Field::inst( 'apellido2' )->validator( 'Validate::notEmpty' ),
Field::inst( 'avatar' )->validator( 'Validate::notEmpty' ),
Field::inst( 'tipoCliente' )->validator( 'Validate::notEmpty' ),
Field::inst( 'email' )->validator( 'Validate::notEmpty' ),
Field::inst( 'status' )->validator( 'Validate::notEmpty' ),
Field::inst( 'direccion' )->validator( 'Validate::notEmpty' ),
Field::inst( 'fechaNac' )->validator( 'Validate::notEmpty' ),
Field::inst( 'ciudad' )->validator( 'Validate::notEmpty' ),
Field::inst( 'provincia' )->validator( 'Validate::notEmpty' ),
Field::inst( 'pais' )->validator( 'Validate::notEmpty' ),
Field::inst( 'cp' )->validator( 'Validate::notEmpty' ),
Field::inst( 'representante' )->validator( 'Validate::notEmpty' ),
Field::inst( 'dniRepresentante' )->validator( 'Validate::notEmpty' ),
Field::inst( 'telefonoContacto' )->validator( 'Validate::notEmpty' ),
Field::inst( 'cobroPreferente' )->validator( 'Validate::notEmpty' ),
Field::inst( 'nacionalidad' )->validator( 'Validate::notEmpty' )
)
->process( $_POST )
Answers
Just in case someone is looking for a solution, these two links helped me out.
https://editor.datatables.net/manual/php/mjoin
https://editor.datatables.net/examples/advanced/joinArray.html
Thank you!