Posting at the end of the page script

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`)
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.

Download the full script here

This site uses one Ajax based comment posting ( where page reloading is not required ), the tutorial for this is not yet developed

Could not connect to MySQL