[eluser]Unknown[/eluser]
Hello CodeIgniter community,
I have an problem handling MySQL CONSTRAINT error.
For obvious reason, I can not delete record in MySQL table because another records in other table reference it.
Quote:A Database Error Occurred
Error Number: 1451
Cannot delete or update a parent row: a foreign key constraint fails (`treg`.`participant`, CONSTRAINT `fk_participant_seminar` FOREIGN KEY (`seminar_seminar_id`) REFERENCES `seminar` (`seminar_id`) ON DELETE NO ACTION ON UPDATE NO ACTION)
DELETE FROM `seminar` WHERE `seminar_id` = '31'
I need to know when this error is occurred to display appropriate error text to user.
Also I would like to have MySQL error number from last query.
How to handle this issue?