-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinit.php
More file actions
26 lines (23 loc) · 731 Bytes
/
init.php
File metadata and controls
26 lines (23 loc) · 731 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
<?php
header("Content-Type: text/html;charset=utf-8");
$servername = "localhost";
$username = "root";
$password = "syspwd";
$dbname = "myDB";
$conn = new mysqli($servername,$username,$password,$dbname);
if (mysqli_connect_error()) {
die("数据库连接失败: " . mysqli_connect_error());
} // connect
$sql = "CREATE TABLE Register (
name VARCHAR(30),
password VARCHAR(30)
)";
if ($conn->query($sql) === TRUE) {
echo "Table MyGuests created successfully";
} else {
echo "创建数据表错误: " . $conn->error;
}
//echo "<input type = 'button' value = 'button' onclick = 'javascript:window.location.href = 'class1.html'>";
header("location:class1.html");
$conn->close();
?>