-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgetAllEvents.php
38 lines (31 loc) · 976 Bytes
/
getAllEvents.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
require_once 'include/DB_Functions.php';
$db = new DB_Functions();
$result=$db->getAllEvents();
// json response array
$response = array("error" => FALSE);
if ($result) {
// looping through all results
// products node
$response["events"] = array();
foreach ($result as $row) {
// temp user array
$event = array();
$event["eid"] = $row["eventID"];
$event["ename"] = $row["ename"];
$event["location"] = $row["location"];
$event["description"] = $row["description"];
$event["edate"] = $row["edate"];
// push single product into final response array
array_push($response["events"], $event);
}
// success
$response["error"] = FALSE;
// echoing JSON response
echo json_encode($response);
} else {
$response["error"] = TRUE;
$response["error_msg"] = "Required parameters (name,age,email or password) is missing!";
echo json_encode($response);
}
?>