Php entry-level message board program implementation code _ PHP Tutorial

Source: Internet
Author: User
Tags php database
Php entry-level message board program implementation code. The message board program needs to be implemented by php + Database. this tutorial mainly describes the implementation process of the message system of phpmysql, including adding, deleting, and editing changes, php + database is required to implement the message board program for php beginners. this tutorial mainly describes the implementation process of the message system for php mysql, including adding, deleting, and editing changes, it is a good material for php beginners to learn.

Project structure:

Add Page: Note: only focus on operations, and there is no time for the interface artist. I hope you can understand it ......

List page:

Modify page:

The SQL file of the message board, which can be directly imported to mysql.

The code is as follows:
Create database form; use form; create table 'message' ('id' tinyint (1) not null auto_increment, 'user' varchar (25) not null, 'title' varchar (50) not null, 'content' tinytext not null, 'lastdate' date not null, primary key ('id ')) ENGINE = InnoDB default charset = gbk AUTO_INCREMENT = 1;


Conn. php database connection file

The code is as follows:
$ Conn = @ mysql_connect ("localhost", "root", "") or die ("database link error ");
Mysql_select_db ("form", $ conn );
Mysql_query ("set names 'gbk '");
?>


Add. php stores the information submitted by the user to the database.

The code is as follows:

Include 'Conn. php ';
If ($ _ POST ['submit ']) {
$ SQL = "INSERT INTO message (id, user, title, content, lastdate) VALUES (NULL, '$ _ POST [user]', '$ _ POST [title]', '$ _ POST [content]', now ())";
Mysql_query ($ SQL );
// Page jump, implemented in javascript
$ Url = "list. php ";
Echo"

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.