Athene Numphe (athene) wrote,
Athene Numphe
athene

  • Mood:
  • Music:

Made of awesome

For the group database project that's due in a week, we already made all these PHP forms and started adding some data and then oops, we realize that we didn't actually make any Foreign Key (FK) to Primary Key (PK) links between any of our 22 tables.

So I did some quick internet research and found out that we had created MyISAM tables when we needed InnoDB tables to link FKs. Then I figured out how to change the tables and how to use the SQL box in PHPmyAdmin to make changes to multiple tables at once. After that I figured out how to use PHPmyAdmin GUI interface to create FK links (it was actually really really easy).

But the image_media table kept giving me a "mysql error 1452" error when I tried to link gameID to the game table, even though the link from characterID to the character table worked just fine. I finally figured out that since we had already been playing with PHP forms, a game with the PK 1 was accidentally deleted, but because we hadn't linked the tables, the record in image_media that said it came from game FK 1 was still there. I changed the record in image_media to the right FK and it worked fine. I even changed the PK in the games table and it automatically updated it in the image_media table.

Yes, I am awesome!
Tags: awesomeness, databases, grad school, program
Subscribe
  • Post a new comment

    Error

    Comments allowed for friends only

    Anonymous comments are disabled in this journal

    default userpic

    Your reply will be screened

    Your IP address will be recorded 

  • 3 comments