Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- //||||||||||||||||||||||||||||||||||||||||||||||\\
- //|| Database Configuration V0.1 ALPHA ||\\
- //|| By Nathan Heinrich ||\\
- //||||||||||||||||||||||||||||||||||||||||||||||\\
- $dbhost ="localhost"; //database IP Adress
- $dbname = "schools1"; //Database Name
- $dbusername = "root"; //Database username
- $dbpass = ""; //database password
- /*||||||||||||||||||||||||||||||||||||||||||||||||*\
- //########## DO NOT EDIT FROM HERE ON!############\\
- \*||||||||||||||||||||||||||||||||||||||||||||||||*/
- $con = mysql_connect ("localhost","root","")
- or die
- ("could not connect: ".mysql_error());
- if (isset($_POST['submit']) == true)
- {
- mysql_select_db($dbname, $con);
- // Create database
- if (mysql_query("CREATE DATABASE $dbname",$con))
- {
- echo "Database created";
- }
- else
- {
- echo "Error creating database: " . mysql_error();
- }
- // Create table
- mysql_select_db($dbname, $con);
- $user = "CREATE TABLE user
- (
- userid int(11) NOT NULL auto_increment,
- username varchar(32) NOT NULL,
- password varchar(255) NOT NULL,
- lastlog date NOT NULL,
- posts int(5) NOT NULL,
- accessid int(2) NOT NULL,
- email varchar(255) NOT NULL,
- PRIMARY KEY (userid)
- )";
- $news = "CREATE TABLE news
- (
- id int(5) NOT NULL auto_increment,
- article text(600) NOT NULL,
- userid int(11) NOT NULL,
- date date NOT NULL,
- PRIMARY KEY (id)
- )";
- // Execute query
- if (mysql_query($user, $con));
- {
- echo " user table created.";
- }
- if (mysql_query($news, $con));
- {
- echo " news table created.";
- }
- }
- mysql_close($con);
- ?>
- <form name="loginform" action="#" method="post">
- <input type="submit" name="submit" value="Create Databases">
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement