Last active
May 9, 2018 02:14
-
-
Save shihchun/27c5f909dc21745628e45d74630b6ae1 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// database connection | |
$servername = "localhost"; | |
$username = "root"; | |
$password = ""; | |
$conn = new mysqli($servername, $username, $password); | |
if ($conn->connect_error) { | |
die("Connection failed:" . $conn->connect_error); | |
} | |
/***************************************************/ | |
//Create database for members | |
$sql = "CREATE DATABASE IF NOT EXISTS members"; | |
if ($conn->query($sql) === TRUE) { | |
echo "Database members created successfully"; | |
} else { | |
echo "Error creating database members:" . $conn->error; | |
} | |
// make bopp the current db | |
$dbname = "members"; | |
$conn = new mysqli($servername, $username, $password, $dbname); | |
// Check connection | |
if ($conn->connect_error) { | |
die("Connection failed:" . $conn->connect_error); | |
} | |
// create empolyee table | |
$sql = "CREATE TABLE IF NOT EXISTS empolyees ( | |
id INT(6) UNSIGNED AUTO_INCREMENT PRIMARY KEY, | |
badge_num VARCHAR(30), | |
fullname VARCHAR(30) , | |
firstname VARCHAR(30) NOT NULL, | |
lastname VARCHAR(30) NOT NULL, | |
gender VARCHAR(30) NOT NULL, | |
birth_date VARCHAR(30) NOT NULL, | |
department VARCHAR(30) NOT NULL, | |
position VARCHAR(30), | |
epc VARCHAR(30) NOT NULL, | |
Image longblob, | |
regist_date TIMESTAMP DEFAULT CURRENT_TIMESTAMP | |
)"; | |
if ($conn->query($sql) === TRUE) { | |
echo "Table empolyee created successfully"; | |
} else { | |
echo "Error creating table bopp:" . $conn->error; | |
} | |
/***************************************************/ | |
// ended connection | |
/***************************************************/ | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment