This topic is locked

How to delete data in child table?

11/19/2011 11:27:14 AM
PHPRunner General questions
K
kiki_lala author

hi.
i have problem. when delete the data in system, it only delete data from parent table.

in child table, the data still inside it. how to solve this problem?
tq =)

C
cgphp 11/20/2011

Check this article: http://xlinesoft.com/phprunner/docs/before_deleting_a_record_check_if_related_records_exist.htm
You can adapt the code to delete records from the detail table:

global $dal;

$tblOrder = $dal->Table("OrderDetails");

$tblOrder->Param["OrderID"]=$deleted_values["OrderID"];

$tblOrder->Delete();
K
kiki_lala author 11/20/2011

i have try this code but it not work.
the data in the child table did not deleted. only the data in parent table was deleted.
can u suggest any other way or can u explain why the code does not work.

  • i'm using phprunner 5.3 build 7113

C
cgphp 11/21/2011

Post the code you have entered in the "Before record deleted" event.

S
Siobhan3 11/22/2011

hey i used you code at its working just fine but the problem i had was (where do i code the part were you delete the column in the parentTable) does it has to have it own function or defferent from delete childtable? im using vb.net and generating query for sql.