Click here to Skip to main content
Click here to Skip to main content

AJAX Generic Comments Module

By , 28 Jul 2006
 

Introduction

This article will show you how to use a generic comments module which is implemented using PHP 4.0, MySQL, and AJAX.

This module is now running here; you can see it in every project review page.

Sample screenshot

Here, the user will enter his information and his comments:

Sample screenshot

When the user clicks on the submit comment button, the comment will be submitted without any page refresh, and the new comment will appear in the page.

Installing database scripts

The database is located in the source code folder in sourcecode/sql/script.sql; just open your MySQL client, and run it to install the database.

How can I add it to my code

  1. Include the files of the comments module in your application folder.
  2. In your code, include the comments.php file to be able to show the comments module.
  3. The comments will show specific comments of every page, according to the ForiegnID which identifies the page which will show the comment (i.e., the ForiegnID of an article can be "A"+$i where $i is the ID of the article in your application database; so, you can use the same module in many pages (articles, news, reviews,..))
<?php
$i =0; // $i can be your article id

$ForeignID = "comment-$i" ; 
require("includes/comments.php");?>

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

About the Author

Hazem Torab
President IRange
Egypt Egypt
Member
I am Hazem Torab, Software Engineer from Egypt,graduated in 2004 Faculty of Engineering Alexandria University Department of Computer Science and Automatic Control.
I started my professional experience in 2004, and I established my software development company in 2007.

Sign Up to vote   Poor Excellent
Add a reason or comment to your vote: x
Votes of 3 or less require a comment

Comments and Discussions

 
Hint: For improved responsiveness ensure Javascript is enabled and choose 'Normal' from the Layout dropdown and hit 'Update'.
You must Sign In to use this message board.
Search this forum  
    Spacing  Noise  Layout  Per page   
GeneralProblems when submittingmemberAcapulco17 Jun '10 - 11:26 
GeneralGeneric Commentmemberpeter0112 Jun '10 - 20:27 
GeneralRe: Generic Commentmemberpeter0112 Jun '10 - 20:36 
Generalgrrrrrrrrrrrmembermarioforever25 Oct '08 - 21:05 
Generalsh*t!!!!!!!!!!!!membermarioforever25 Oct '08 - 20:55 
GeneralSecurity issues !!!!memberLetusek29 May '07 - 1:06 
Questiondont know php but aspmemberSaadz12 Apr '07 - 3:34 
GeneralNicememberparadoxxl3 Aug '06 - 9:25 
GeneralRe: Nicememberzegv2 Dec '06 - 10:40 
GeneralRe: Nicememberzegv2 Dec '06 - 10:59 
Could just be my lack of programming knowledge ;\

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Permalink | Advertise | Privacy | Mobile
Web02 | 2.6.130523.1 | Last Updated 28 Jul 2006
Article Copyright 2006 by Hazem Torab
Everything else Copyright © CodeProject, 1999-2013
Terms of Use
Layout: fixed | fluid