-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstudenttable.php
More file actions
33 lines (28 loc) · 822 Bytes
/
studenttable.php
File metadata and controls
33 lines (28 loc) · 822 Bytes
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
<?php
$servername = "localhost";
$username = "uspfstudent";
$password = "1234567";
$dbname = "schooldb";
// Create connection
$conn = new mysqli($servername, $username, $password, $dbname);
// Check connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
// sql to create table
$sql = "CREATE TABLE studenttable (
Student_IdNumber INT(6) UNSIGNED AUTO_INCREMENT PRIMARY KEY,
Student_FamilyName VARCHAR(30) NOT NULL,
Student_Middlename VARCHAR(30) NOT NULL,
Student_EmailAddress VARCHAR(50) NOT NULL,
Student_HomeAddress VARCHAR(50) NOT NULL,
Student_MobileNumber INT(12) NOT NULL,
Student_Course VARCHAR(30) NOT NULL
)";
if ($conn->query($sql) === TRUE) {
echo "Table MyGuests created successfully";
} else {
echo "Error creating table: " . $conn->error;
}
$conn->close();
?>