-
Notifications
You must be signed in to change notification settings - Fork 0
/
db.php
43 lines (34 loc) · 1.23 KB
/
db.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
<?php/*
$servername = "localhost";
$username = "root";
$password = "";
$dbname = "";
$conn = mysqli_connect($servername, $username, $password, $dbname);
// Create database --------------------------------------------------------
$sql = "CREATE DATABASE IF NOT EXISTS db";
if (mysqli_query($conn, $sql)) {
echo "Database created successfully<br>";
} else {
echo "Error creating database: " . mysqli_error($conn) . "<br>";
}
$dbname = 'db';
mysqli_select_db ( $conn , $dbname);
if (!$conn) {
die("select db connection failed: " . mysqli_connect_error());
}
//create accelaration table --------------------------------------------------
$sql = "CREATE TABLE IF NOT EXISTS `datasets` (
`data1` VARCHAR(50) NOT NULL,
`data2` VARCHAR(50) NOT NULL,
`ID` INT NOT NULL AUTO_INCREMENT,
PRIMARY KEY (`ID`))";
if(mysqli_query($conn, $sql)){
echo "Table accelaration created successfully<br>";
} else {
echo "Error creating accelaration table: " . mysqli_error($conn). "<br>";
}
$query = "INSERT INTO datasets (data1, data2) VALUES
('1', '2'), ('4', '5') ,('3', '5'),('6', '7'),('2', '4'),('0', '3'),('3', '2')";
$conn->query($query);
mysqli_close($conn);*/
?>