On the first line, I include the connection page
include'include/conn.php';
Next, I make SQL to make a query:
//CREATE THE MAIN DATABASE AND RECOGNIZE THE DATABASE IF IT ALREADY EXIST
$database = 'CREATE DATABASE IF NOT EXISTS user';
mysql_query($database,$db) or die (mysql_error($db));
Choosing a database that is just created, named user.
//Make sure the recently created database is the active one
mysql_select_db ('user', $db) or die(mysql_error($db));
Then make a query to create table attributes:
//CREATE THE USER TABLE
$query =' CREATE TABLE user(
userID INTEGER UNSIGNED NOT NULL AUTO_INCREMENT,
userName VARCHAR (255),
password VARCHAR (255),
email VARCHAR (255),
fullName VARCHAR (255),
address1 VARCHAR (255),
address2 VARCHAR (255),
city VARCHAR (255),
country VARCHAR (255),
PRIMARY KEY (userID)
)ENGINE = MyISAM';
mysql_query($query, $db) or die (mysql_error($db));
echo 'Database is created';
So now the database user is created with its all attributes.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment