-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmodel.php
50 lines (35 loc) · 1.07 KB
/
model.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
<?php
include('model_globals.php');
# DB access to be used throughout the code
function getRoomDefs() {
$query = "SELECT name, json" .
" FROM rooms" .
" ORDER BY name";
# get result
$result = mysql_query($query) or die("Unable to retrieve room definitions");
# init working variables
$defs = array();
# loop
if (mysql_num_rows($result) != 0) {
while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) {
#print_r($row);
$defs[ $row['name'] ] = $row['json'];
/*
array_push($session['speaking'], array(
"name" => $name,
"twitter" => $row['twitter'],
"url" => $row['url']
));
*/
} # end while
} # endif
return $defs;
}
function saveRoomDef($name, $json) {
$query = "INSERT INTO rooms (name,json) VALUES ('" .
$name . "', '" . $json . "');";
# get result
$result = mysql_query($query) or die("Unable to save room definition");
return $result;
}
?>