Creating a comment system with a simple rating system for each comment.
tables : 1.For the comments and it is called comments
and it has three columns : id
, name
, comment
2. for the IP of the user that did the rating and it is called voted_ip
and it has three columns id
, comment_id
, user_ip
The purpose of the voted_ip table is that i need to save the IP address for each rate to validate it that it cannot rate again if it exists.
I created a foreign key from the child table voted_ip
in the column comment_id
connecting it to the parent table comments
in the column id
following the steps at this link and this video on how to create a working foreign key except that the child table still do not update after a comment or a rate is inserted.
as follow :
I thought about that there might be another step or I have to do something in the php side of the project. What am I missing?
插入“注释”时,数据不会插入另一个表“voted_ip”中,您必须明确地添加它,这些约束仅用于检查不是自动在其他表中添加数据。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.