-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrestaurant.php
114 lines (97 loc) · 3.62 KB
/
restaurant.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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
<!DOCTYPE html>
<html>
<head>
<title>Restaurant | Gourmet</title>
<link type="text/css" rel="stylesheet" href="css/rest_list.css" />
<link type="text/css" rel="stylesheet" href="css/search_restro.css" />
</head>
<body>
<div class="header">
<div class="header_top" >
<div class="left_buttons">
<a href="./food_list.php" class="header_hover" >Cuisines</a>
<a href="./rest_list.php">Restaurant</a>
</div>
<div class="right_buttons">
<?php
include('login_buttons.php');
?>
</div>
</div>
</div>
<div class="headerbg"></div>
<center>
<div class="bodyhead">
</div>
<?php
//session_start();
include('PhpMysqlConnectivity.php');
$r_id = $_GET['r_id'];
$is_owner = false;
if(isset($_SESSION['u_id'])){
$u_id = $_SESSION['u_id'];
$q = "SELECT * FROM owner o WHERE o.r_id = $r_id AND o.u_id = '$u_id'";
$result = mysqli_query($link,$q);
if($result){
$is_owner = true;
}
}
//displaying details of the restaurant
$q = "SELECT * FROM restaurant WHERE id = '$r_id'";
$result = mysqli_query($link,$q);
$restro_data = mysqli_fetch_array($result,MYSQLI_ASSOC);
unset($restro_data['id']);
echo '<div class="bodytrbg restro"><div style="background:rgba(50,50,50,0.8);border-radius: 5px;">';
echo '<table border=0 cellpadding=2>';
echo '<tr>';
echo '<td class="field name">'.$restro_data["name"].' ('.$restro_data["veg_nonveg"].')</td>';
$piclen = 40*$restro_data["star"];
echo '<td class="field starttd" ><div class="star" style="width:'.$piclen.'px;"></div></td>';
echo '<td class="field open">'.$restro_data["open_time"].' - '.$restro_data["close_time"].'</td>';
echo '</tr><tr>';
echo '<td colspan=2 class="field address"> '.$restro_data["address"].', '.$restro_data["city"].'</td>';
if ( $is_owner) {
echo '<td rowspan=2 ><a class="styledanchor" href="add_serve_form.php?r_id='.$r_id.'">Add Food Item</a></td>';
}
echo '</tr><tr>';
echo '<td colspan=2 class="field mobile"> '.$restro_data["mobile_no"].'</td>';
echo '</tr>';
echo '</table>';
echo '</div></div>';
/*
foreach ($restro_data as $key => $value) {
echo $key.' '.$value.'<br>';
}
*/
//displaying menu items
$q = "SELECT * FROM food f, serves s WHERE r_id = '$r_id' AND f_id = f.id;";
$result = mysqli_query($link,$q);
echo '<div class="labelhead">Food Items available : </div>';
//echo '<br>';
while($row = mysqli_fetch_array($result,MYSQLI_ASSOC)){
echo '<div class="bodytrbg food"><div style="background:rgba(50,50,50,0.8);border-radius: 5px;">';
echo '<table border=0 cellpadding=2>';
echo '<tr>';
echo '<td class="field name">'.$row["name"].'</td>';
$f_id = $row['f_id'];
if($is_owner){
echo '<td rowspan=2 ><a class="styledanchor" href="./delete_item.php?r_id='.$r_id.'&f_id='.$f_id.'">Delete</a></td>';
}
echo '</tr><tr>';
echo '<td class="field mobile"> ₹ '.$row["price"].'</td>';
echo '</tr>';
echo '</table>';
echo '</div></div>';
/*
echo $row['name'].' ';
echo $row['price'].' ';
echo $row['discount'].' ';
$f_id = $row['f_id'];
echo '<br>';*/
}
echo '<br>';
?>
<br><br>
</center>
</body>
</html>