-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmodel.php
More file actions
32 lines (24 loc) · 873 Bytes
/
model.php
File metadata and controls
32 lines (24 loc) · 873 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
<?php
$dbhandle = sqlite_open('billing.db', 0666, $error);
if (!$dbhandle)
die ($error);
$createBillInfo = "CREATE TABLE BillInfo(Id integer PRIMARY KEY,
UtilityName text NOT NULL,
BilledAmount integer NOT NULL,
BilledDate integer NOT NULL)";
$createSurvey = "CREATE TABLE Survey(Id integer PRIMARY KEY,
Shower integer NOT NULL,
Bath integer NOT NULL,
Dishwasher integer NOT NULL,
Laundry integer NOT NULL,
Gardening integer NOT NULL)";
$createGoal = "CREATE TABLE Goal(ID integer PRIMARY KEY,
CurrentGoal text)";
$okBillInfo = sqlite_exec($dbhandle, $createBillInfo, $error);
$okSurvey = sqlite_exec($dbhandle, $createSurvey, $error);
$okGoal = sqlite_exec($dbhandle, $createGoal, $error);
if (!$okBillInfo || !$okSurvey || !$okGoal)
die("Cannot execute query. $error");
echo "Database 'Bill Info' created successfully";
sqlite_close($dbhandle);
?>