Delete Records with childs

If you're a new user of AppGini, feel free to ask general usage questions, or look for answers here.
Post Reply
SkayyHH
Veteran Member
Posts: 481
Joined: 2015-04-27 21:18

Delete Records with childs

Post by SkayyHH » 2015-04-28 20:10

Hello,

i try a employee database. When the user delete an employee all child entries should deleted too. I have seen, that the child entries will not be deleted. How to set up the app, that childs will be deleted too?

Thanks much, Kai

Satya Kavala
Veteran Member
Posts: 45
Joined: 2015-04-15 06:33
Location: Hyderabad
Contact:

Re: Delete Records with childs

Post by Satya Kavala » 2015-04-30 05:57

Hi,
I'm sending the code for deleting the records with child tables.
I had two child tables for an parent table i place this code on parent table php file in hooks folder.
place the query in before delete function of employee.php and executes it it will work for you.



$sql="DELETE FROM `table1` WHERE `parent primary key`=".$selectedID; //here primary key means employee id
sql($sql,$eo);

$sql1="DELETE FROM `table2` WHERE `parent primary key`=".$selectedID;
sql($sql1,$eo);
Thanks&Regards
Satya Kavala
[email protected]

SkayyHH
Veteran Member
Posts: 481
Joined: 2015-04-27 21:18

Re: Delete Records with childs

Post by SkayyHH » 2015-04-30 07:08

Thanks you very much.

Best regards, Kai

Post Reply