PHP script to delete records

jaheli

New Member
I am trying to write some PHP code to delete records. Are there any methods and/or techniques I could use to handle the deletes cleanly, especially when deleting records which have associated repeat groups, which are stored in Fabrik's repeat tables? I am concerned that the code could get messy and become a nightmare to maintain wen the application is modified.

Basically, I am looking for a method to call, to effect the delete and maintain referential integrity and not be plagued by orphaned records and, possibly, ensure child records are not deleted before their parents.
 
Fabrik has an option to 'Delete joined data' within the Lists-->Data-->Joins section. So deleting the parent record should also delete the child records as well.

On this basis you only need to script the removal of the parent record.

This does of course rely on the fact that Fabrik is doing all the record keeping in the core and you are not using any plugins to insert records in other tables.

I can't really advise to much on how you remove the records without any further information. You may want to use the schedule with the PHP plugin should you wish to automate this and then just run normal PHP code with the Fabrik \ Joomla API.

http://docs.joomla.org/Inserting,_Updating_and_Removing_data_using_JDatabase
 
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top