-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgetMenu.php
More file actions
44 lines (31 loc) · 1.09 KB
/
getMenu.php
File metadata and controls
44 lines (31 loc) · 1.09 KB
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
<?php
if (isset($_REQUEST['id'])) {
include_once 'globalConsts.php';
$id= $_REQUEST['id'];
$response = array();
mysql_connect(SERVER_ADDRESS, USER, PASS);
if (mysqli_connect_errno()) {
//echo "Could not connect to database";
$response["success"] = 0;
$response["message"] = "Failed to connect to database";
echo json_encode($response);
exit;
}
mysql_select_db(DATABASE);
$sql = "SELECT fnm.FNM_Name,fnm.FNM_ID FROM food_nutrition_master fnm,restaurant_menu rm"
." WHERE rm.RM_Restaurant_ID=".$id
." AND rm.FNM_ID=fnm.FNM_ID";
$result = mysql_query($sql);
if (mysql_num_rows($result)) {
$response["success"] = 1;
$items = array();
while ($row = mysql_fetch_array($result)) {
$item = array();
$item['FNM_ID'] = $row['FNM_ID'];
$item['FNM_Name'] = $row['FNM_Name'];
array_push($items, $item);
}
$response['items'] = $items;
echo json_encode($response);
}
}