Problem with a multiple table update
Problem with a multiple table update
Hi,
I have a table that contains people's information member_info. In this table I have a type field that identifies who the information belongs to (memi_Type). in this field I can set it to Self (3), spouse (5), child(8)... Every self record has a member record. Then the member record is linked to other member_info records to attach spouses and kids.
The following PHP setup works fine to get the self records in the datatable.
However when I use editor and this PHP Code ...when I change the name of the self person (which is memi_Type 3). It also changes the name of the spouse (Which is a different memi_Type, but is linked in the left join using member.mem_Id)
It looks like the update is not taking into account the where clause in order to only update the record that is memi_Type 3.
Please help.
$out = Editor::inst( $db, 'member', 'mem_Id' )
->field(
Field::inst( 'member.mem_No' ),
Field::inst( 'member_info.memi_FirstName' ),
Field::inst( 'member_info.memi_LastName' ),
Field::inst( 'member.mem_Active' ),
Field::inst( 'selectors.sel_Name' )
)
->leftJoin( 'member_info', 'member_info.member_mem_Id', '=', 'member.mem_Id' )
->leftJoin( 'Selectors', 'Selectors.sel_Id', '=', 'member.mem_Active' )
->where("member_info.memi_Type","3","=")
->process($_POST)
->data();
echo json_encode( $out );