EchoFool Posted December 1, 2008 Share Posted December 1, 2008 Hey there, I curious to know if there was a way to link foreign keys to your main table in such a way that when you delete the row from the main table your database can auto delete the foreign keys from other tables ? An example: user_table: UserID | Name | 2 | bleh | user_items: UserID | Quantity | ItemID | RecordID 2 | 3 | 2 | 956 Now if i delete User ID 2 from user_table is it possible for phpmyadmin to also delete UserID 2 from user_items and any other table which is interlinked like this ? I can't find out how to do it on phpmyadmin, i was told you go to : Click on the table you want Click on the structures tab Below the fields you should see a relation view Which i did but all it shows me is information of the table nothing else. Hope you can help me out. Quote Link to comment Share on other sites More sharing options...
rhodesa Posted December 1, 2008 Share Posted December 1, 2008 http://dev.mysql.com/doc/refman/5.0/en/innodb-foreign-key-constraints.html Quote Link to comment Share on other sites More sharing options...
EchoFool Posted December 1, 2008 Author Share Posted December 1, 2008 Isn't that for creating tables with mysql.. what if i have already created my tables? Quote Link to comment Share on other sites More sharing options...
rhodesa Posted December 2, 2008 Share Posted December 2, 2008 You should be able to use ALTER TABLE commands 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.