I've built a large database in MySQL and created all the relationships between the tables with SQLYog. That's all well and good but in my PHP site that I'm building I often have trouble when it comes to deleting rows from the database, I often run into referential integrity constraints. So then I try deleting data or setting the field to NULL from the linking tables first. I can usually get this to work with some trial and error but there seems to be no method or proper process in which I should do this. Should I be using the 'on delete set NULL or cascade delete settings'? I don't know which to use and worried it might delete important data in the other tables.
Do people even bother setting the relationship constraints in their databases? I mean it would seem a lot easier to do a delete then write some extra lines to update the other tables that were linked to it in the PHP code.
Any help would be much appreciated.