-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.php
More file actions
32 lines (21 loc) · 666 Bytes
/
Copy pathindex.php
File metadata and controls
32 lines (21 loc) · 666 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
require 'engine.php';
# Initialzie database
$db = new SQLite3('database.db');
require 'data.php';
# ========
$groups = array();
$groups_result = $db->query('SELECT * FROM groups;');
while($result = $groups_result->fetchArray(SQLITE3_ASSOC)) {
$groups[$result['id']] = $result['name'];
}
# Fetch functions
// echo(json_encode($groups));
$grouped_functions = array();
$functions = $db->query('SELECT * FROM functions;');
while($row = $functions->fetchArray(SQLITE3_ASSOC)){
$grouped_functions[$groups[$row['group_id']]][] = $row;
}
$message = new Template("templates/index.html");
$message->grouped_functions = $grouped_functions;
echo $message;