Skip to content
Advertisement

php How to link comment sql to the blog sql

first time here and I hope you guys can help me further.

I have created a blogging system to use by mine employees via an admin login system. As well a login system and registration system to use by my customers/viewers. So now I created a comment section for the blog system where people can commenting. The problem is that on each blog the comments are the same. How can link the comments to each blogID?

Advertisement

Answer

When you are entering users’ comments in the comments table of your database.Send the blog-post-id(unique for every blog post) along with rest of the form. you can accomplish that using a hidden input like this

and when you are loading comments on a blog-posts page select comments from comments table and sort them using that blog-post-id. like this

User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement