Quantcast
Channel: Free community support — DataTables forums
Viewing all articles
Browse latest Browse all 35438

Editor create instance writing to two different tables?

$
0
0

Hi everyone, Has anyone managed to use the "editor_create" server script to add data to mulitple tables? For example, I wish to add data inputted from a "create" lightbox to a table "projects", then add the newly created "project_id" into the table "persons".

Something like this?!?

$editor = Editor::inst( $db, 'project', 'project_id' )
    ->fields(
        Field::inst( 'project.numero' )->validator( 'Validate::notEmpty' ),
        Field::inst( 'project.title' )->validator( 'Validate::notEmpty' )
);
$editor2 = Editor::inst( $db, 'persons', 'person_id' )
    ->fields(
        Field::inst( 'person.numero' )->validator( 'Validate::notEmpty' ),
        Field::inst( 'person.project_id' )
);
$data = $editor
$data2 = $editor2
    ->process($_POST)
    ->data();
echo json_encode( $data );
echo json_encode( $data2 );

I am sure it is straight forward, but I can not find anything in regards to this. Looking forward to some feedback. thanks, nige


Viewing all articles
Browse latest Browse all 35438

Trending Articles