Hi Steve,
Im using INNODB Tables and have all my relationships working well with xataface eg. Cascade Updates work perfect.
I have some foreign key restraints on my tables of ON DELETE Restrict as I don't want users to accidentally delete a parent record and result in all the children records being deleted.
So now if I try to delete a parent I get this error (see below) which is correct referential integrity is being maintained.
How can I capture this error and return a simple message "Record cannot be deleted due to existing child records"
ERROR:
Fatal error: [pear_error: message="Failed to delete record 'AG Stn2' because of an SQL error: 'Cannot delete or update a parent row: a foreign key constraint fails (`roxspacetest/outcropsample`, CONSTRAINT `outcropsample_ibfk_9` FOREIGN KEY (`Station_idStation`) REFERENCES `station` (`idStation`) ON UPDATE CASCADE)'" code=321 mode=return level=notice prefix="" info=""] in C:\Program Files\xampp\htdocs\dataface\Dataface\Application.php on line 1323
Regards
Paul