LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   PHP code for "Post comments" for your website? (https://www.linuxquestions.org/questions/programming-9/php-code-for-post-comments-for-your-website-718938/)

frenchn00b 04-14-2009 12:25 AM

PHP code for "Post comments" for your website?
 
PHP code for "Post comments" for your website?

Is there some source code somehow?

Thanks
Best regards

jstephens84 04-16-2009 04:29 PM

Could you elaborate a little on what you are looking for? I am not totally sure I am understanding your question. I think you are asking for code that will show all the comments posted for a blog

frenchn00b 04-17-2009 03:14 AM

Quote:

Originally Posted by jstephens84 (Post 3511470)
Could you elaborate a little on what you are looking for? I am not totally sure I am understanding your question. I think you are asking for code that will show all the comments posted for a blog

actually something like this:
http://lh3.ggpht.com/darraghdoyle/SC...ss_comment.JPG

or blog-like, beautiful or not, the simpler the bester usually

jstephens84 04-17-2009 08:39 AM

Quote:

Originally Posted by frenchn00b (Post 3511971)
actually something like this:
http://lh3.ggpht.com/darraghdoyle/SC...ss_comment.JPG

or blog-like, beautiful or not, the simpler the bester usually

Ok - so you should have a few tables. Users, BlogArticle, and Comments. Then when someone clicks on the link on the blog it would go to say comment.php?blgart=1 what that would say is go to the comments form page and add a comment for blog article 1. Then after they submit it would go to the comments table. The what you would do is in php create a script that might have the following (depending on how the table is setup)
Code:

$query = sprinf('Select * from comments where blogid = ', mysql_real_escape_string($blogid))
$results = mysql_query($query, $db)
while($row = mysql_fectch_array($results, MYSQL_ASSOC)
{
  echo "<div id='comment'>";
  echo "<h3>$row['name']<h3>"; // This represents the comment name
  echo "<p>$row['comment']</p>; // this will output the comment left
  echo "</div>;
}

this is a rough outline and should be expanded on but I hope that is what you had in mind.


All times are GMT -5. The time now is 02:53 PM.