Answer the question
In order to leave comments, you need to log in
How to properly link mysql tables?
The PHPMyAdmin database has two tables, articles and comments, which share a page _id column. I want to link them through this column with this query:
ALTER TABLE `comments` ADD FOREIGN KEY (`page_id`) REFERENCES `articles`(`id`) ON DELETE RESTRICT ON UPDATE RESTRICT;
MySQL Answer: Documentation #1452.
What am I doing wrong and how to connect them correctly?
Answer the question
In order to leave comments, you need to log in
Make sure that for each page_id value in comments there is a corresponding id in articles.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question