| In this article, you will learn how to design and develop | | | | login, message display, message input and a main |
| a simple online chat room with PHP and MySQL. This | | | | frame integrating the display and input sections. Thus, it |
| tutorial explains every steps of the development, | | | | needs the following four files to |
| including both database design and PHP programming. | | | | work:login.phpmain.phpdisplay.phpspeak.phpStep 3: |
| Basic computer skills and knowledge of HTML and | | | | Write the code1. login.php (just a HTML form) |
| PHP are required. Ok, let's begin now.Step 1: Design | | | | |
| Database Table. Create table "chat" in MySQL | | | | User LoginPlease input your nickname and enter |
| database to store basic chat information: chtime (chat | | | | 2. main.php |
| time), nick (user nickname) and words (chat message, | | | | |
| less than 150 characters) | | | | My Chat Room |
| | | | |
| mysql> CREATE TABLE chat-> chtime | | | | 3. display.phpThis file is used to get message records |
| DATATIME,-> nick CHAR (10) NOT NULL,-> words | | | | from database and display the results. To keep the |
| CHAR (150);Step 2: Design Structure. This simple online | | | | size of database, old messages are deleted and only |
| chat room includes the following four sections: user | | | | the newest 15 messages are displayed. |