After reading an article or news or any tutorial on a website, the visitor can post his or her comments at the end. You must have seen such comments at blog pages posted by visitors are displayed at the end of the page. Below such postings there will be the form which you can use and post your comments. Such a provision adds lot of value to the main content as replies and questions are both available at one place. Author of the article can post answer to specific questions raised by readers. Over time this system itself became a FAQ ( frequently asked questions ) page as over the subject lot of discussion became available at one place. Blog pages are somewhat similar to this script. This script can be further extended to have main posting by site admin , so it can be used as Blogging script and you can run you own blog within your site.
You can compare this with a forum but there are many differences here. First here any one can post without becoming member or signing up but usually in a forum postings are allowed after signup. The process of posting became very simple as a single form is used. Here postings are focused to the main topic presented by the author. Where in a forum topic can be any thing within permitted areas of the forum.
We will ask the visitors to enter three fields at the posting form. One is there name, second one is there email address and third one is there comment or post. Here while displaying we will not display the email address of the poster and we will only display name and the comment.
We will use MySQL database to store the postings of the visitors. We will use one table only for these records and one more table to store site admin login information. If this script is used as a part of an existing system then this admin table is not required. Let us first discuss about the main table, we call it cmt_post. This table cmt_post will have 7 fields. Here is the structure of the table.
CREATE TABLE `cmt_post` (
`post_id` int(5) NOT NULL auto_increment,
`p_name` varchar(10) NOT NULL,`dt` date NOT NULL,
`name` varchar(25) NOT NULL,
`email` varchar(50) NOT NULL,`dtl` text NOT NULL,
`status` varchar(4) NOT NULL default 'ns',
UNIQUE KEY `post_id` (`post_id`,`p_name`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=3 ;
This main cmt_post table will have fields to store the name, email address, data of post and comment. It also has to store the unique page number or page name by which we can identify which comment or posting belongs to which page. We will maintain one more filed and call it as status filed which will tell us where the posting is approved by site admin or not. By default all posting are to be approved by site admin. We will maintain this status filed with two values, ns(not seen) or fresh posting and second value is apv( approved ) . For each record once added we will generate one unique post id ( post_id) . For this post_id filed we will use auto increment property of MySQL table.
Yea um, I am keep getting a error saying:
Warning: mysql_connect(): Can't connect to local MySQL server through socket
'/usr/local/mysql-5.0/data/mysql.sock' (2) in
/home/content/d/r/a/dragonlover/html/
funtut/comment/comment/config.php on line 19
Could not connect to MySQL
smo
25-01-2009
You have to check your mysql connection first. You should have correct userid and password to connect to Mysql table. There is a tutorial on this issue. First establish connection and then your script will work.
asdas
17-02-2009
test comment
Haji
22-02-2009
Hi there i can't login in the admin page every time i try to login it says wrong password. And i dont even know how to make admin name and password please help on how to accecc admin.. and the other thing is how to add the script into everypage in my website. thanks alot
smo
22-02-2009
Go to page on installing comment posting script. It is there in further reading section. There default id and how it works is explained.
tbabatunde
03-03-2009
thanks for this php tutorial
moles
03-03-2009
Warning: mysql_query()
[function.mysql-query]:
Access denied for user 'ODBC'@'localhost' (using password: NO) in C:\AppServ\www\comment
\cmt-display.php on line 2
Warning: mysql_query()
[function.mysql-query]: A link to the server could not be established in C:\AppServ\www\comment
\cmt-display.php on line 2
Warning: mysql_fetch_array():
supplied argument is not a valid MySQL result resource in C:\AppServ\www\comment\
cmt-display.php on line 5
asd
10-04-2009
Warning: mysql_connect():
Can\'t connect to local MySQL server through socket
'/usr/local/mysql-5.0/data/
mysql.sock' (2) in
/home/content/d/r/a/dragonlover/html/
funtut/comment/comment/config.php on line 19
Could not connect to MySQL.
sasa
18-04-2009
why wont this work
john doe
06-05-2009
ajax feature is very cool.
james
15-05-2009
let me test
winstons
21-06-2009
Can somebody help me i dont anderstand whats the problem:
Warning: mysql_query() [function.mysql-query]: Access denied for user 'watching'@'localhost' (using password: NO) in /home/watching/public_html/comment/cmt-display.php on line 2
Warning: mysql_query() [function.mysql-query]: A link to the server could not be established in /home/watching/public_html/comment/cmt-display.php on line 2
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/watching/public_html/comment/cmt-display.php on line 5
333
29-06-2009
at the end. You must have seen such comments at blog pages posted by visitors are displayed at the end of the page. Below such postings there will be the form which you can use and post your comments. Such a provision adds lot of value to the main content as replies and questions are both available at one place. Author of the article can post answer to specific questions raised by readers. Over time this system itself became a FAQ ( frequently asked questions ) page as over the subject lot of discussion became available at one place. Blog pages are somewhat similar to this script. This script can be further extended to
sajjad
01-07-2009
i am tesing this comments blogs
james
31-07-2009
Is the tutorial and download for the script is same as the one i am now posting comments on your site?
Jack Frost
31-07-2009
really good site and always with good scripts...thanks
smo
02-08-2009
James, this is not the same script. Some changes are added and it is based on Ajax. The tutorial is not yet developed and download link is not kept. Shortly it will be available.
Paltonio Fraga
12-08-2009
very useful programs. Thanks for this. Even not using a mysql database, we can use any/another source of data.
ahmed
23-08-2009
yup not too bad but i wanna how to connect mysql with ajax
Ludwe
02-09-2009
How to post a comment and the page not reload?
smo
03-09-2009
By using Ajax.
Sumera
11-11-2009
this site is great!!!!!!!!!
Andy John
19-11-2009
Excellent post.This was actually what I was looking for, and I am glad that I finally came here! Thanks for sharing the such information with us.
Marcel
26-12-2009
When will the ajax feature be ready for download? Another thing here is this. I tried using this script to add comments to the cms tutorial here but it keeps displaying the same comment for all articles. I guess the $p_name=1be is responsible. How can i make it dynamic just like the cms so i can have different comments on different pages. Please admin, note i'm working with the cms file from this website.
Tunde
29-12-2009
This is good. Just some adjustment
i changed require"....php" to include"...php" and i was able to log in.
i am using dynamic php web pages so i changed
$p_name = $_GET['mytopicid']; so that a comment for a page is not onto another. I am a php newbie and very chuffed i did this on my own.
niraj
19-09-2010
You have to check your mysql connection first. You should have correct userid and password to connect to Mysql table. There is a tutorial on this issue. First establish connection and then your script will work.
Khodor
14-11-2010
Is there any demo for this script
Parkour
05-01-2012
Your post is incredible, can’t wait for more updates
Finn
23-04-2012
Thankyou this script is quite nice and easy to work with
mali
30-06-2012
Is there one without MY SQL
malib
10-12-2012
is there 1 with sql???
3R4
11-02-2014
I LOVE THIS SCRIPT
Subhra
18-07-2014
Nice one
Victor
20-07-2014
new post
Jordan Rusnac
27-12-2014
heya this is the one im looking for
Tania
06-02-2015
Is this using databse?
tulasi
27-03-2015
thank for helpful script
Tania
15-06-2015
Is this using databse?
✖
We use cookies to improve your browsing experience. . Learn more