-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfetch_menu.php
More file actions
33 lines (29 loc) · 1.05 KB
/
fetch_menu.php
File metadata and controls
33 lines (29 loc) · 1.05 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
<?php
require_once 'DBconnect.php';
if (isset($_POST['restaurant'])) {
$restaurant = $_POST['restaurant'];
$sql = "SELECT m.ITEM_NAME, m.Cuisine, m.Quantity, m.Price from restaurants r, menu m WHERE r.R_ID = m.R_ID AND r.R_NAME = '$restaurant'";
$result = mysqli_query($conn,$sql);
if ($result->num_rows > 0) {
echo '<table class="restaurant_table">';
echo " <tr>
<th>Item Name</th>
<th>Cuisine</th>
<th>Quantity</th>
<th>Price</th>
</tr>";
while ($row = $result->fetch_assoc()) {
echo " <tr>
<td>" . htmlspecialchars($row['ITEM_NAME']) . "</td>
<td>" . htmlspecialchars($row['Cuisine']) . "</td>
<td>" . htmlspecialchars($row['Quantity']) . "</td>
<td>" . htmlspecialchars($row['Price']) . "</td>
</tr>";
}
echo "</table>";
} else {
echo "No menu items available for this restaurant.";
}
}
$conn->close();
?>