StartVM Posted August 21, 2013 Report Share Posted August 21, 2013 Hello, I am trying to delete airports and airline directly from the SQL database through phpmyAdmin which is in my cPanel, but it seems that I don't have sufficient permissions. I am the owner. This is the error message I get when trying to remove an airline. SQL query: DELETE FROM `delta291_delta1`.`phpvms_airlines` WHERE `phpvms_airlines`.`id` =2 MySQL said: #1451 - Cannot delete or update a parent row: a foreign key constraint fails (`delta291_delta1`.`phpvms_schedules`, CONSTRAINT `phpvms_schedules_ibfk_1` FOREIGN KEY (`code`) REFERENCES `phpvms_airlines` (`code`) ON UPDATE CASCADE) Quote Link to comment Share on other sites More sharing options...
StartVM Posted August 21, 2013 Author Report Share Posted August 21, 2013 And it gives me a link to this page which I don't understand. http://dev.mysql.com/doc/refman/5.5/en/delete.html Quote Link to comment Share on other sites More sharing options...
BaRBeR Posted August 21, 2013 Report Share Posted August 21, 2013 That isn't a permission problem is it? Quote Link to comment Share on other sites More sharing options...
Administrators simpilot Posted August 21, 2013 Administrators Report Share Posted August 21, 2013 #1451 - Cannot delete or update a parent row: a foreign key constraint fails (`delta291_delta1`.`phpvms_schedules`, CONSTRAINT `phpvms_schedules_ibfk_1` FOREIGN KEY (`code`) REFERENCES `phpvms_airlines` (`code`) ON UPDATE CASCADE) The database is setup with constraints so when one field is updated it is also updated in another table that uses the same field. From the error it looks like you are trying to delete an airline that has schedules in the database, ie deleteing "DAL" when you have schedules using "DAL" as the code still in the database. You will need to delete/change all the "DAL" schedules before you can delete the airline. 1 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.