forked from sriram1998/Ecell-community
-
Notifications
You must be signed in to change notification settings - Fork 0
/
sql.php
54 lines (49 loc) · 1.19 KB
/
sql.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
<?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);
}
// Create database
$sql = "CREATE DATABASE e_comm";
if ($conn->query($sql) === TRUE) {
} else {
}
$conn->close();
$servername = "localhost";
$username = "root";
$password = "";
$dbname = "e_comm";
// Create connection
$conn = mysqli_connect($servername, $username, $password, $dbname);
// Check connection
if (!$conn) {
die("Connection failed: " . mysqli_connect_error());
}
// sql to create table users
$sql = "CREATE TABLE users (
id INT(11) UNSIGNED AUTO_INCREMENT PRIMARY KEY,
name VARCHAR(50) NOT NULL,
dob DATE NOT NULL,
gender varchar(20) NOT NULL,
rollNum varchar(20) NOT NULL,
email varchar(50) NOT NULL,
phoneNum varchar(50) NOT NULL,
dept varchar(10) NOT NULL,
q1 INT(11) NOT NULL,
q2 INT(11) NOT NULL,
q3 INT(11) NOT NULL,
q4 INT(11) NOT NULL,
q5 INT(11) NOT NULL,
q6 INT(11) NOT NULL,
q7 INT(11) NOT NULL
)";
if ($conn->query($sql) === TRUE) {
} else {
}
mysqli_close($conn);
?>