when I delete a record, which has a relationship ?
- Single Page
Posted 11 July 2012 - 01:13 AM
anyone know how to do
Posted 11 July 2012 - 05:38 AM
Try to play with callback_before_delete function. It seems to me that is the easiest way.
Posted 11 July 2012 - 17:15 PM
For example you have a table of clients and a table of phone numbers related to clients. Whenever you delete a client you want to delete all phone numbers of that particular client. If this is your case then use cascade delete on your mysql, considering you are using InnoDB.
If you don't know how to use the on delete cascade, then check this post at stackoverflow:
http://stackoverflow.com/questions/511361/how-do-i-use-on-delete-cascade-in-mysql
Hope this helps