-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdatabase.php
More file actions
48 lines (39 loc) · 1.41 KB
/
database.php
File metadata and controls
48 lines (39 loc) · 1.41 KB
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
<?php
$conn = mysql_connect("localhost","root","") or die(mysql_error());
$sql = "CREATE DATABASE IF NOT EXISTS upgradation";
if(mysql_query($sql , $conn)){
echo "Database Created Succesfully" ."</br>";
}
else{
echo "Error creating database" ."</br>". mysql_error($conn);
}
mysql_select_db("upgradation" , $conn);
$sql1 = "CREATE TABLE IF NOT EXISTS seatsDetails(
Branch text NOT NULL,
availableSeats int(11) NOT NULL)";
if ( mysql_query($sql1,$conn))
echo "Table created Succesfully1" ."</br>";
else
echo "Error creating Table 1"."</br>". mysql_error($conn);
$sql1 = "CREATE TABLE IF NOT EXISTS studentDetails(
Name text NOT NULL,
EnrollmentNumber varchar(11) NOT NULL,
Branch text NOT NULL,
CPI text NOT NULL,
preFirst text NOT NULL,
preSecond text NOT NULL,
preThird text NOT NULL,
Allocated text)";
if ( mysql_query($sql1,$conn))
echo "Table created Succesfully2"."</br>";
else
echo "Error creating Table 2"."</br>". mysql_error($conn);
$sql3 = "CREATE TABLE IF NOT EXISTS adminAccount(
email text NOT NULL,
password text NOT NULL)";
if ( mysql_query($sql3,$conn))
echo "Table created Succesfully3"."</br>";
else
echo "Error creating Table 3"."</br>". mysql_error($conn);
mysql_close($conn);
?>