-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathinit_tables.php
62 lines (52 loc) · 1.84 KB
/
init_tables.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
<!DOCTYPE html>
<html>
<head>
<title> AsyncTalent - Initialize Tables</title>
</head>
<body>
<?php
$dbhost = 'localhost';
$dbuser = 'Assign2';
$dbpass = 'password';
$conn = new mysqli($dbhost, $dbuser, $dbpass, 'Assign2');
if($conn){
echo "Connected";
echo "<br>";
}
if(! $conn )
{
die('Could not connect: ' . mysql_error());
}
//User Profiles Table
$query = "DROP table Async_Users;";
$conn->query($query) or die ();
$query = "CREATE TABLE Async_Users (User_id int primary key not null AUTO_INCREMENT, Email char(255) not null, Username char(25) not null, Password char(255) not null, Type char(25) not null);";
$conn->query($query) or die ("Invalid create" . $conn->error);
echo "User table initialized";
echo "<br>";
//ADD Async_Users
$p = 'password';
$password = hash('sha256', $p);
$email1 = "[email protected]";
$email2 = "[email protected]";
$name1 = "Sam Hunt";
$name2 = "James Bay";
$query = "INSERT INTO Async_Users (Email, Username, Password, Type)
VALUES
('$email1', '$name1', '$password', 'recruiter')";
$conn->query($query) or die ("invalid user insert" . $conn->error);
$query = "INSERT INTO Async_Users (Email, Username, Password, Type)
VALUES
('$email2', '$name2', '$password', 'recruiter')";
$conn->query($query) or die ("invalid user insert" . $conn->error);
//Resumes Table
$query = "DROP table Resumes;";
$conn->query($query) or die ();
$query = "CREATE TABLE Resumes (Resume_id int primary key not null AUTO_INCREMENT, Recruiter_id char(255) not null, name char(255), edu decimal(4,2), lang int, work int, xfactor int, total_score int, green int, yellow int, red int, batch char(255));";
$conn->query($query) or die ("Invalid create" . $conn->error);
echo "Resume table initialized";
echo "<br>";
echo "All tables initialized";
?>
</body>
</html>