As a PHP developer, I was sometimes asked to make a shoutbox. If the same thing happens to you, here's a quick guide. Obviously, you want to add your own CSS to it on top, but here is the basic idea.
We need a MySQL database table and three PHP files.
First, we need a file to save the database information
---file #1: mysql.inc.php---
<?php
# Simply Shouting - ashoutboxexample
# File name:mysql.inc.php
# Description: A file to hold database info.
$host ='localhost';
$user ='database_user_name';
$password='database_user_password';
$name ='database_name';
?>
Create a data table with four fields. We are named shouts. Previously you may not have this SQL file, create a php file "install.php". After this file has been used once, remember to delete it!
--File #2: install.php--
<?php
# Simply Shouting-ashoutboxexample
# File name:install.php
# Description:creates the database table.
Include the database info file
Include ("mysql.inc.php");
Connecting to a database
$connection = @mysql_connect ($host, $user, $password) or Die (Mysql_error ());
$db = @mysql_select_db ($name, $connection) or Die (Mysql_error ());
If we already have a table named "shouts", we need to delete it first.
$sql = ' DROP TABLE IF EXISTS ' shouts ';
$result = @mysql_query ($sql, $connection) or Die (Mysql_error ());
Now identify the table that does not have the same name, create it
$sql = ' CREATE TABLE ' shouts ' (
' id ' int (one) not NULL auto_increment,
' Timestamp ' timestamp not NULL DEFAULT Current_timestamp,
' shoutby ' varchar default NULL,
' Shout ' varchar default NULL,
PRIMARY KEY ' id ' (' ID ')
) Type=myisam auto_increment=1 ';
echo ' Creating table: \ ' shouts\ ' ... ';
Close connection
$result = @mysql_query ($sql, $connection) or Die (Mysql_error ()); >
<title>simply Shouting-Installation </title>
<body>
<br/>
Your installation process is complete. Please remove all installation files from your server immediately. This program contains the following installation files: <br/>
<br/>
1) install.php<br/>
<br/>
<br/>
<!--I could just send them to index.phpautomatically, but then the they ' d wonder if it created correctly or not. -->
Click <a href= "index.php" > here </a> start .