-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathserver.php
64 lines (52 loc) · 1.63 KB
/
server.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
63
64
<?php
$servername = "localhost";
$username = "root";
$password = "";
// Create connection
$conn = new mysqli($servername, $username, $password);
// Check connection
if ($conn->connect_error)
{
die("Connection failed: " . $conn->connect_error);
}
$sql = "CREATE DATABASE IF NOT EXISTS complaint;";
if ($conn->query($sql) === FALSE)
{
echo "Database error 1";
}
$conn = new mysqli($servername, $username, $password, "complaint");
if ($conn->connect_error)
{
die("Connection failed: " . $conn->connect_error);
}
$sql = "CREATE TABLE IF NOT EXISTS `complaint`.`studentdb`
(`fname` VARCHAR(20),
`lname` VARCHAR(20), `gender` VARCHAR(20),
`category` VARCHAR(20), `dept` VARCHAR(30),
`enroll` VARCHAR(20), `email` VARCHAR(50),
`mobile` VARCHAR(20), `ctype` VARCHAR(50),
`complaint` VARCHAR(200) NOT NULL); ";
if ($conn->query($sql) === FALSE)
{
echo "Database error 3". $conn->error;
}
$sql = "CREATE TABLE IF NOT EXISTS `complaint`.`facultydb`
(`fname` VARCHAR(20),
`lname` VARCHAR(20), `gender` VARCHAR(20),
`category` VARCHAR(20), `dept` VARCHAR(30),
`empid` VARCHAR(20),`designation` VARCHAR(20),
`email` VARCHAR(50), `mobile` VARCHAR(20),
`ctype` VARCHAR(50), `complaint` VARCHAR(200) NOT NULL); ";
if ($conn->query($sql) === FALSE)
{
echo "Database error 3". $conn->error;
}
$sql = "CREATE TABLE IF NOT EXISTS `complaint`.`admin`
(`id` INT NOT NULL AUTO_INCREMENT, `name` VARCHAR(20) NOT NULL,
`email` VARCHAR(50) NOT NULL, `password` VARCHAR(50) NOT NULL,
PRIMARY KEY (`id`)); ";
if ($conn->query($sql) === FALSE)
{
echo "Database error 3". $conn->error;
}
?>