Page 1 of 1

Help how to insert id from parent table to child table

Posted: 2017-02-09 18:16
by globaldrip8
Parent table :
Id
Name

Child table :
Id
Parent_id
Name

Now i want to insert child table automaticaly in before insert hooks on parent table
I've tried so many many times but what i got is always same
The value of parent_id is always 0

Can anyone help me?

Re: Help how to insert id from parent table to child table

Posted: 2018-11-16 21:32
by xbox2007
function files_after_insert($data, $memberInfo, &$args){

sql("INSERT INTO child table (Parent_id) values ({$data['selectedID']})", $eo);