Click here to Skip to main content
13,559,658 members
Click here to Skip to main content
Add your own
alternative version


37 bookmarked
Posted 28 Jul 2006
Licenced CPOL

AJAX Generic Comments Module

, 28 Jul 2006
Rate this:
Please Sign up or sign in to vote.
Source code for a generic comments module, using AJAX/PHP/MySQL.


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,..))
$i =0; // $i can be your article id

$ForeignID = "comment-$i" ; 


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


About the Author

Hazem Torab
CEO Enozom Software
Egypt Egypt
Hazem Torab, founder & CEO at Enozom Software, a fast growing software company in Alexandria. Hazem has more than 6 years of experience in management and team leading, and 10+ years of professional experience in the software development field.

Hazem also is a co-founder and chairman of Ayaady for Investment and Agriculture, a crowd funded company and the first Egyptian online fresh meat shop directly from the farm to the consumers.

Before founding Enozom, Hazem was a co-founder & CEO of IRange Software. He also worked at ITWorx and Raya Software after his graduation in 2004 from Alexandria University, Faculty of Engineering, Computer and Systems Department.

You may also be interested in...

Comments and Discussions

GeneralProblems when submitting Pin
Acapulco17-Jun-10 11:26
memberAcapulco17-Jun-10 11:26 
GeneralGeneric Comment Pin
peter0112-Jun-10 20:27
memberpeter0112-Jun-10 20:27 
GeneralRe: Generic Comment Pin
peter0112-Jun-10 20:36
memberpeter0112-Jun-10 20:36 
Generalgrrrrrrrrrrr Pin
marioforever25-Oct-08 21:05
membermarioforever25-Oct-08 21:05 
GeneralSH*T!!!!!!!!!!!! Pin
marioforever25-Oct-08 20:55
membermarioforever25-Oct-08 20:55 
GeneralSecurity issues !!!! Pin
Letusek29-May-07 1:06
memberLetusek29-May-07 1:06 
Questiondont know php but asp Pin
Saadz12-Apr-07 3:34
memberSaadz12-Apr-07 3:34 
GeneralNice Pin
paradoxxl3-Aug-06 9:25
memberparadoxxl3-Aug-06 9:25 
GeneralRe: Nice Pin
zegv2-Dec-06 10:40
memberzegv2-Dec-06 10:40 
GeneralRe: Nice Pin
zegv2-Dec-06 10:59
memberzegv2-Dec-06 10:59 
GeneralRe: Nice Pin
brdaidoline15-Apr-09 2:50
memberbrdaidoline15-Apr-09 2:50 
GeneralRe: Nice Pin
brdaidoline15-Apr-09 2:56
memberbrdaidoline15-Apr-09 2:56 
GeneralRe: Nice Pin
brdaidoline15-Apr-09 2:58
memberbrdaidoline15-Apr-09 2:58 

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

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Cookies | Terms of Use | Mobile
Web03-2016 | 2.8.180527.1 | Last Updated 28 Jul 2006
Article Copyright 2006 by Hazem Torab
Everything else Copyright © CodeProject, 1999-2018
Layout: fixed | fluid