walkonet Posted August 13, 2007 Share Posted August 13, 2007 Hey everyone! I've been working on a CMS of sorts and i got alot done but i cant figure out how to set up my DB for comments... Let me explain. on my main page I have a list of posts with view comment link and a add comments link. but really i just want a link like this (# of comments) COMMENTS which would take the user to a comments page that displays the comments already there and let them post new ones. im extremely confused on how i should structure this..... here's what i have done: http://mattwalko.phpnet.us/MWBlog/index.php *please note that its only half done* but i hope someone could point me in the right direction structurally speaking to accomplish a stupid comment script... I mean i think it should work off of the post id ? e.g. "view_posts.php?id=6" and somehow transfer the id of the post to the add comments page? and should i be using joins in the DB to accomplish this stuff? lmoa im really confuzed!!! any help or pointer in the direction would be great. and btw if you havent figured it out im pretty new to php lol i thought about somehow changing "view_posts.php?id=6" to "view_posts.php?cid=6" and joining the post id and the new comment id... but im probably way off.... BTW on my site admin panel works (*not manage comments*), and archives Quote Link to comment https://forums.phpfreaks.com/topic/64644-user-comments-problems/ Share on other sites More sharing options...
frost Posted August 13, 2007 Share Posted August 13, 2007 You could use a hidden form input to pass the post id? Quote Link to comment https://forums.phpfreaks.com/topic/64644-user-comments-problems/#findComment-322693 Share on other sites More sharing options...
reages Posted August 13, 2007 Share Posted August 13, 2007 i'm not sure if i understood your problem correctly, but a common implementation would be to always include the post id and add the comment id if you want to view a specific comment for a post. as for adding a new comment, its up to you to implement it in another .php or reuse the view_post.php, either way you'd still need to include the post id. if you're still lost, you could always check how boards like phpfreaks or phpbb do it regards. Quote Link to comment https://forums.phpfreaks.com/topic/64644-user-comments-problems/#findComment-322796 Share on other sites More sharing options...
walkonet Posted August 14, 2007 Author Share Posted August 14, 2007 I'm soo sorry for the really bad post firrst of all. I was really tired and couldn't explain the issue propery. What I want to to is on the main page (index.php) show a list of posts i have made. Along with that I want an option to post a comment to the specific post. What im not shure about is how i should set up my database table for the comments. Here's what I am thinking: DB: MWBlog TABLE: comments FIELDS: comment_id, nick, ((optional->)email, ,website), entry Now for the comment page: (this is where i need advise) Setup a link somehow that will let the user post a comment to the specific post id and either have the comment(s) posted on that page, or on another page with the original post at the top? I not even shure that would be the best way to do it and i have no idea how to accomplish it. The only thing i know how to do so far to help me accomplish this ( I think ) is passing the id to the target script for record insertion. And if thats how I do it then would i use the post_id as the var to pss on or comment var in the link that would take the user to the script that allows the visitors to post thier comment? (e.g. http://somedomain.com/index.php?id=(post_id) or http://somedomain.com/index.php?cid=(comment_id) also do I just make a simple record insertion page for the comments? And if I do that how am i supposed to display the comments for the specific post? The only way I can think of is using left join and i really dont understand it... I've read about it in three different books and saw some examples but still it's not clicking for me. Im proably making this alot harder than it really is im just not shure how to go about it or even make the first step. Quote Link to comment https://forums.phpfreaks.com/topic/64644-user-comments-problems/#findComment-323276 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.