Skip to content
Permalink
master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
<?php
$servername = "localhost";
$username = "root";
$password = "";
$dbname = "appdb";
// Create connection
$conn = new mysqli($servername, $username, $password);
// Check connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error . "<br>");
}
// Create database
$sql = "CREATE DATABASE appdb";
if ($conn->query($sql) === TRUE) {
echo "Database created successfully<br>";
} else {
echo "Error creating database: " . $conn->error . "<br>";
}
$conn->close();
// Create connection
$conn = new mysqli($servername, $username, $password, $dbname);
// Check connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error . "<br>");
}
// Create accounts table
$sql = "CREATE TABLE accounts (
id INT(6) UNSIGNED AUTO_INCREMENT PRIMARY KEY,
username VARCHAR(16) NOT NULL UNIQUE,
name VARCHAR(16) NOT NULL,
cardID INT(7) NOT NULL UNIQUE,
hash VARCHAR(100) NOT NULL,
salt VARCHAR(50) NOT NULL
)";
if ($conn->query($sql) === TRUE) {
echo "Table accounts created successfully<br> ";
} else {
echo "Error creating table: " . $conn->error . "<br>";
}
// Create ec114 Table
$sql = "CREATE Table ec114 (
day_week VARCHAR(10) NOT NULL UNIQUE,
`08` VARCHAR(10),
`09` VARCHAR(10),
`10` VARCHAR(10),
`11` VARCHAR(10),
`12` VARCHAR(10),
`13` VARCHAR(10),
`14` VARCHAR(10),
`15` VARCHAR(10),
`16` VARCHAR(10),
`17` VARCHAR(10),
`18` VARCHAR(10)
)";
if ($conn->query($sql) === TRUE) {
echo "Table ec114 created successfully<br>";
} else {
echo "Error: " . $conn->error . "<br>";
}
// Populate ec114 table
$sql = "INSERT INTO ec114 (day_week,`08`, `09`, `10`, `11`, `12`, `13`, `14`, `15`, `16`, `17`, `18`)
VALUES
('Monday', NULL, NULL, 'antel', 'antel', 'antel', NULL, NULL, NULL, 'antel', 'antel', NULL),
('Tuesday', 'antel', 'antel', 'antel', NULL, NULL, NULL, 'antel', 'antel', NULL, NULL, 'antel'),
('Wednesday', NULL, NULL, 'antel', 'antel', 'antel', NULL, NULL, 'antel', 'antel', 'antel', NULL),
('Thursday', NULL, NULL, 'antel', 'antel', NULL, NULL, NULL, NULL, 'antel', 'antel', NULL),
('Friday', NULL, NULL, 'antel', 'antel', 'antel', 'antel', 'antel', 'antel', NULL, NULL, NULL)";
if ($conn->query($sql) === TRUE) {
echo "Table timetable populated successfully<br>";
} else {
echo "Error: " . $conn->error . "<br>";
}
// Create ec115 Table
$sql = "CREATE Table ec115 (
day_week VARCHAR(10) NOT NULL UNIQUE,
`08` VARCHAR(10),
`09` VARCHAR(10),
`10` VARCHAR(10),
`11` VARCHAR(10),
`12` VARCHAR(10),
`13` VARCHAR(10),
`14` VARCHAR(10),
`15` VARCHAR(10),
`16` VARCHAR(10),
`17` VARCHAR(10),
`18` VARCHAR(10)
)";
if ($conn->query($sql) === TRUE) {
echo "Table ec115 created successfully<br>";
} else {
echo "Error: " . $conn->error . "<br>";
}
// Populate ec115 table
$sql = "INSERT INTO ec115 (day_week,`08`, `09`, `10`, `11`, `12`, `13`, `14`, `15`, `16`, `17`, `18`)
VALUES
('Monday', NULL, NULL, 'john', 'john', NULL, NULL, NULL, NULL, 'john', 'john', NULL),
('Tuesday', 'john', 'john', NULL, NULL, NULL, NULL, NULL, NULL, 'john', 'john', NULL),
('Wednesday', NULL, NULL, 'john', 'john', 'john', 'john', NULL, NULL, NULL, NULL, NULL),
('Thursday', NULL, NULL, NULL, NULL, NULL, NULL, 'john', 'john', NULL, NULL, 'john'),
('Friday', NULL, NULL, 'john', 'john', 'john', 'john', 'john', 'john', 'john', 'john', 'john')";
if ($conn->query($sql) === TRUE) {
echo "Table timetable populated successfully<br>";
} else {
echo "Error: " . $conn->error . "<br>";
}
// Create antel Table
$sql = "CREATE Table antel (
day_week VARCHAR(10) NOT NULL UNIQUE,
`08` VARCHAR(25),
`09` VARCHAR(25),
`10` VARCHAR(25),
`11` VARCHAR(25),
`12` VARCHAR(25),
`13` VARCHAR(25),
`14` VARCHAR(25),
`15` VARCHAR(25),
`16` VARCHAR(25),
`17` VARCHAR(25),
`18` VARCHAR(25)
)";
if ($conn->query($sql) === TRUE) {
echo "Table antel created successfully<br>";
} else {
echo "Error: " . $conn->error . "<br>";
}
// Populate antel table
$sql = "INSERT INTO antel (day_week,`08`, `09`, `10`, `11`, `12`, `13`, `14`, `15`, `16`, `17`, `18`)
VALUES
('Monday', NULL, NULL, 'Digital Forensics', 'Digital Forensics', 'Digital Forensics', NULL, 'Theta', 'Theta', 'Ethical Hacking', 'Ethical Hacking', NULL),
('Tuesday','Ethical Hacking', 'Ethical Hacking', 'Ethical Hacking', NULL, 'Theta', 'Theta', 'Digital Forensics', 'Digital Forensics', NULL, NULL, 'Ethical Hacking'),
('Wednesday', NULL, NULL, 'Ethical Hacking', 'Ethical Hacking', 'Ethical Hacking', NULL, NULL, 'Digital Forensics', 'Digital Forensics', 'Digital Forensics', NULL),
('Thursday', 'Theta', 'Theta', 'Digital Forensics', 'Digital Forensics', NULL, NULL, 'Theta', 'Theta', 'Ethical Hacking', 'Ethical Hacking', NULL),
('Friday', NULL, NULL, 'Ethical Hacking', 'Ethical Hacking', 'Digital Forensics', 'Digital Forensics', 'Ethical Hacking', 'Ethical Hacking', NULL, NULL, NULL)";
if ($conn->query($sql) === TRUE) {
echo "Table timetable populated successfully<br>";
} else {
echo "Error: " . $conn->error . "<br>";
}
// Create john Table
$sql = "CREATE Table john (
day_week VARCHAR(10) NOT NULL UNIQUE,
`08` VARCHAR(25),
`09` VARCHAR(25),
`10` VARCHAR(25),
`11` VARCHAR(25),
`12` VARCHAR(25),
`13` VARCHAR(25),
`14` VARCHAR(25),
`15` VARCHAR(25),
`16` VARCHAR(25),
`17` VARCHAR(25),
`18` VARCHAR(25)
)";
if ($conn->query($sql) === TRUE) {
echo "Table john created successfully<br>";
} else {
echo "Error: " . $conn->error . "<br>";
}
// Populate john table
$sql = "INSERT INTO john (day_week,`08`, `09`, `10`, `11`, `12`, `13`, `14`, `15`, `16`, `17`, `18`)
VALUES
('Monday', NULL, NULL, 'Network Architecture', 'Network Architecture', NULL, NULL, NULL, 'Theta', 'CISCO', 'CISCO', NULL),
('Tuesday', 'CISCO', 'CISCO', NULL, NULL, 'Theta','Theta', NULL, NULL, 'Network Architecture', 'Network Architecture', NULL),
('Wednesday', NULL, NULL, 'Network Architecture', 'Network Architecture','CISCO', 'CISCO', NULL, NULL, 'Theta','Theta', NULL),
('Thursday', NULL, NULL, NULL, NULL, NULL, NULL, 'CISCO', 'CISCO', NULL, NULL,'CISCO'),
('Friday', 'Theta', 'Theta', 'Network Architecture', 'Network Architecture', 'Network Architecture', 'Network Architecture', 'CISCO', 'CISCO', 'CISCO', 'CISCO', 'CISCO')";
if ($conn->query($sql) === TRUE) {
echo "Table timetable populated successfully<br>";
} else {
echo "Error: " . $conn->error . "<br>";
}
$conn->close();
?>