Help how to insert id from parent table to child table

Discussions related to customizing hooks. Hooks are documented at http://bigprof.com/appgini/help/advanced-topics/hooks/
Post Reply
globaldrip8
Posts: 24
Joined: 2015-12-19 03:59

Help how to insert id from parent table to child table

Post by globaldrip8 » 2017-02-09 18:16

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?

xbox2007
Posts: 29
Joined: 2016-12-16 16:49

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

Post by xbox2007 » 2018-11-16 21:32

function files_after_insert($data, $memberInfo, &$args){

sql("INSERT INTO child table (Parent_id) values ({$data['selectedID']})", $eo);
Last edited by xbox2007 on 2018-11-16 21:34, edited 1 time in total.

Post Reply