[eluser]solid9[/eluser]
For example I will create a new table called "swap".
Now in swap table I want to include a Foreign key from "users" table.
How I do about this?, using PHPMyAdmin?
[eluser]InsiteFX[/eluser]
See the MySQL Alter command
Code:
ALTER TABLE `topics` ADD FOREIGN KEY(`topic_cat`) REFERENCES `categories` (`cat_id`) ON DELETE CASCADE ON UPDATE CASCADE;
ALTER TABLE `topics` ADD FOREIGN KEY(`topic_by`) REFERENCES `users` (`user_id`) ON DELETE RESTRICT ON UPDATE CASCADE;
ALTER TABLE `posts` ADD FOREIGN KEY(`post_topic`) REFERENCES `topics` (`topic_id`) ON DELETE CASCADE ON UPDATE CASCADE;
ALTER TABLE `posts` ADD FOREIGN KEY(`post_by`) REFERENCES `users` (`user_id`) ON DELETE RESTRICT ON UPDATE CASCADE;