Jump to content

Database Error


StartVM

Recommended Posts

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: dot.gif

#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)

Link to comment
Share on other sites

  • Administrators

#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.

  • Like 1
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...