wwdbank Setup


(delete setup.php once the database and parent, user and messaging tables have been successfully created).
"; if (isset($_POST['submit'])) { $mysql_user=($_POST['mysql_user']); $mysql_pass=($_POST['mysql_pass']); $lastname=($_POST['lastname']); $firstname=($_POST['firstname']); $wwdbank_user=($_POST['wwdbank_user']); $wwdbank_pass=($_POST['wwdbank_pass']); $email=($_POST['email']); echo "

Database setup progress:

"; //CONNECT TO MYSQL $conn = mysql_connect("localhost", "$mysql_user", "$mysql_pass") OR DIE (mysql_error()); //create database $sql = "CREATE DATABASE `wwdbank`"; $result=mysql_query($sql)OR DIE(mysql_error()); if ($result) { echo "Database created successfully.

"; //choose database mysql_select_db ("wwdbank", $conn) OR DIE (mysql_error()); } else { echo "Database not created!

"; } //create parent table $query1="CREATE TABLE `parent` ( `parent_id` INT NOT NULL AUTO_INCREMENT , `lastname` VARCHAR( 200 ) NOT NULL , `firstname` VARCHAR( 200 ) NOT NULL , `user_name` VARCHAR( 200 ) NOT NULL , `pass` VARCHAR( 200 ) NOT NULL , `email` VARCHAR( 200 ) NOT NULL , PRIMARY KEY ( `parent_id` ) , FULLTEXT ( `lastname` , `firstname` , `user_name` ) ) TYPE=MyISAM"; $result1=mysql_query($query1)OR DIE(mysql_error()); if ($result1) { echo "Parent table created successfully!

"; } else { echo "Parent table has not been created!

"; } //create user table $query2="CREATE TABLE `user` ( `user_id` INT NOT NULL AUTO_INCREMENT , `lastname` VARCHAR( 200 ) NOT NULL , `firstname` VARCHAR( 200 ) NOT NULL , `user_name` VARCHAR( 200 ) NOT NULL , `pass` VARCHAR( 200 ) NOT NULL , `email` VARCHAR( 200 ) NOT NULL , PRIMARY KEY ( `user_id` ) , FULLTEXT ( `lastname` , `firstname` , `user_name` ) ) TYPE=MyISAM"; $result2=mysql_query($query2)OR DIE(mysql_error()); if ($result2) { echo "User table created successfully!

"; } else { echo "User table has not been created!

"; } //create messaging table $query3="CREATE TABLE `messaging` ( `message_id` INT NOT NULL AUTO_INCREMENT , `title` TEXT NOT NULL , `body` TEXT NOT NULL , `from_user` VARCHAR( 100 ) NOT NULL , `to_user` VARCHAR( 100 ) NOT NULL , `date` DATE NOT NULL , PRIMARY KEY ( `message_id` ) , FULLTEXT ( `title` , `body` , `from_user` , `to_user` ) ) TYPE=MyISAM"; $result3=mysql_query($query3)OR DIE(mysql_error()); if ($result3) { echo "Messaging table created successfully!

"; } else { echo "Messaging table has not been created!

"; } //add parent to parent table $query4="INSERT into parent VALUES ('','$lastname','$firstname','$wwdbank_user','$wwdbank_pass','$email')"; $result4=mysql_query($query4)OR DIE (mysql_error()); if ($result4) { echo "Your details have been added to the PARENT table!

"; } else { echo "Your details were not added to the PARENT table!

"; } } else { //SHOW FORM FOR SUBMISSION OF MYSQL USER DETAILS echo"

Please provide your MySQL root user details (these are needed to setup up the databases).

MySQL root user details


MySQL User Name:
MySQL Password:

The details below will be added to the PARENT table.

Your USER NAME is the name that will be displayed to other users.


Last Name:
First Name:
wwdbank User Name:
Email:
wwdbank Password:
 
"; } echo "

©2005 wwd

"; ?>