-
Notifications
You must be signed in to change notification settings - Fork 0
/
_createTable.php
50 lines (43 loc) · 1.14 KB
/
_createTable.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
<?php
// Database configuration
$servername = "localhost";
$username = "root";
$password = "";
$dbname = "database00";
// Connect to the database
$conn = new mysqli($servername, $username, $password, $dbname);
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
// Create table1 for currentURL
$sql = "CREATE TABLE IF NOT EXISTS table1 (
id INT AUTO_INCREMENT PRIMARY KEY,
url VARCHAR(255) NOT NULL,
count INT DEFAULT 0
)";
$conn->query($sql);
// Create table2 for historyURL
$sql = "CREATE TABLE IF NOT EXISTS table2 (
id INT AUTO_INCREMENT PRIMARY KEY,
history VARCHAR(255) NOT NULL,
count INT DEFAULT 0
)";
$conn->query($sql);
// Create table3 for ipAddress
$sql = "CREATE TABLE IF NOT EXISTS table3 (
id INT AUTO_INCREMENT PRIMARY KEY,
ip VARCHAR(50) NOT NULL,
count INT DEFAULT 0
)";
$conn->query($sql);
// Create table4 for country
$sql = "CREATE TABLE IF NOT EXISTS table4 (
id INT AUTO_INCREMENT PRIMARY KEY,
country VARCHAR(100) NOT NULL,
count INT DEFAULT 0
)";
$conn->query($sql);
// Close the database connection
$conn->close();
echo "Tables created successfully.";
?>