-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetTables.php
39 lines (36 loc) · 1.49 KB
/
setTables.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
<?php
include './includes/dbconfig.php';
$errors=array();
//Table structure for table `list_for_the_day`
$listTable="CREATE TABLE IF NOT EXISTS `list_for_the_day` (
`day_id` int(11) NOT NULL AUTO_INCREMENT,
`day_date` varchar(25) NOT NULL,
`user_list` text NOT NULL,PRIMARY KEY (day_id)
) ENGINE=InnoDB DEFAULT CHARSET=latin1";
$query= mysqli_query($con, $listTable);
if(!empty(mysqli_error_list($con))){
$errors[0]=mysqli_error_list($con);
}
$userTable="CREATE TABLE `users` (
`user_id` int(11) NOT NULL AUTO_INCREMENT,
`member_id` int(11) NOT NULL,
`fname` varchar(100) NOT NULL,
`lname` varchar(100) NOT NULL,
`mname` varchar(100) NOT NULL,
`sex` varchar(50) NOT NULL,
`rating` int(11) NOT NULL,
`expiration` varchar(25) NOT NULL,
`last_played` varchar(25) NOT NULL,
`email` varchar(255) NOT NULL,PRIMARY KEY (user_id), UNIQUE KEY (`member_id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1";
$query= mysqli_query($con, $userTable);
if(!empty(mysqli_error_list($con))){
$errors[1]=mysqli_error_list($con);
}
if(empty($errors)){
echo json_encode(array('error'=>'false','message'=>'Success'));
}
else{
echo json_encode(array('error'=>'true','message'=>$errors));
}
?>