Add a record with a where clause
Add a record with a where clause
amweiss98
Posts: 12Questions: 4Answers: 1
I'm using DataTables Editor and whenever I try to add a record in a table that includes a where clause, it always has null for the field. This is the code I'm using and I've hard coded the where clause parameter to 1 (the new row always has NULL for coid_fk)
use DataTables\Editor,
DataTables\Editor\Field,
DataTables\Editor\Format,
DataTables\Editor\Mjoin,
DataTables\Editor\Options,
DataTables\Editor\Upload,
DataTables\Editor\Validate;
$editor = Editor::inst( $db, 'tbl_parameters','qs_id' )
->fields(
Field::inst( 'qs_param' ),
Field::inst( 'qs_desc' ),
Field::inst( 'coid_fk' )
)
->where( 'coid_fk', 1)
->process( $_POST )
->json();
This works fine for getting the table using the where clause, but it doesn't work for adding a new row. Can you please help with this? Thanks
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
ok...answered my own question..just needed to add
to the fields array
Thanks for posting back - good to hear you've got it working.
Allan