-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtable1.php
More file actions
34 lines (28 loc) · 841 Bytes
/
Copy pathtable1.php
File metadata and controls
34 lines (28 loc) · 841 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
/*########################################
create tables to store the data
########################################*/
//Essential database login data
$servername = "localhost";
$username = "root";
$password = "";
$dbname = "adveisordb";
// Create connection
$conn = new mysqli($servername, $username, $password, $dbname);
// Check connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
$sql = "CREATE TABLE current_game (
id INT(32) UNSIGNED AUTO_INCREMENT PRIMARY KEY,
game_data VARCHAR(1024) NOT NULL,
game_id int(32) NOT NULL,
reg_date TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
)";
if ($conn->query($sql) === TRUE) {
echo "Table created successfully";
} else {
echo "Error creating table: " . $conn->error;
}
$conn->close();
?>