need a little guidance on a recursive db delete |
[eluser]dan.syme[/eluser]
Having troubles visualizing what needs to happen here, this has been my thought process so far 1. create a query to find all records in 4 tables that are associated with each other through id and parent_id's. 2. run the result through a foreach and delete each record in the tables. 3. stuck on the correct way to delete the records from the table. Code: $this->db->select('group1.id, group2.id, group2.parent_id, group3.id, group3.parent_id, group4.id, group4.parent_id'); Thanks,
[eluser]dan.syme[/eluser]
duh <- im a idiot there is no need to run the result through a loop. I aleady built my delete string so all i need to do is $this->db->delete();
[eluser]dan.syme[/eluser]
spoke to soon, still cannot delete from all tables. error: Unknown column 'group1.id' in 'where clause' DELETE FROM `group2` WHERE `group1`.`id` = '10' using the following code. Code: $tables = array('group1', 'group2', 'group3', 'group4');
[eluser]dan.syme[/eluser]
its an issue discussed before, found a work around at this thread. The fix requires hacking the core. http://ellislab.com/forums/viewthread/63991/
[eluser]maria clara[/eluser]
got the same problem.. has anyone have solved this? |
Welcome Guest, Not a member yet? Register Sign In |