-
Notifications
You must be signed in to change notification settings - Fork 1
/
install.php
62 lines (52 loc) · 1.82 KB
/
install.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
51
52
53
54
55
56
57
58
59
60
61
62
<?php
//Connect to database
$servername = "localhost";
$username = "root"; //put your phpmyadmin username.(default is "root")
$password = ""; //if your phpmyadmin has a password put it here.(default is "root")
$dbname = "";
$conn = new mysqli($servername, $username, $password, $dbname);
// Create database
$sql = "CREATE DATABASE biometricattendace";
if ($conn->query($sql) === TRUE) {
echo "Database created successfully";
} else {
echo "Error creating database: " . $conn->error;
}
echo "<br>";
$dbname = "biometricattendace";
$conn = new mysqli($servername, $username, $password, $dbname);
// sql to create table
$sql = "CREATE TABLE IF NOT EXISTS `users` (
`id` int(11) NOT NULL AUTO_INCREMENT PRIMARY KEY,
`username` varchar(100) NOT NULL,
`serialnumber` double NOT NULL,
`gender` varchar(10) NOT NULL,
`email` varchar(50) NOT NULL,
`fingerprint_id` int(11) NOT NULL,
`fingerprint_select` tinyint(1) NOT NULL DEFAULT '0',
`user_date` date NOT NULL,
`time_in` time NOT NULL,
`del_fingerid` tinyint(1) NOT NULL DEFAULT '0',
`add_fingerid` tinyint(1) NOT NULL DEFAULT '0'
) ENGINE=InnoDB DEFAULT CHARSET=latin1";
if ($conn->query($sql) === TRUE) {
echo "Table users created successfully";
} else {
echo "Error creating table: " . $conn->error;
}
$sql = "CREATE TABLE IF NOT EXISTS `users_logs` (
`id` int(11) NOT NULL AUTO_INCREMENT PRIMARY KEY,
`username` varchar(100) NOT NULL,
`serialnumber` double NOT NULL,
`fingerprint_id` int(5) NOT NULL,
`checkindate` date NOT NULL,
`timein` time NOT NULL,
`timeout` time NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1";
if ($conn->query($sql) === TRUE) {
echo "Table users_logs created successfully";
} else {
echo "Error creating table: " . $conn->error;
}
$conn->close();
?>