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?
Data is not inserted in the other table "voted_ip" on insertion in "comment" by itself you have to add it explicitly this constraints are just for checking not for adding data in other table automatically.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With