RoamEase/indexes/user/getInfo/getFoInfo.php
2025-06-06 17:31:03 +08:00

37 lines
911 B
PHP

<?php
include "../../ConnectDB.php";
$id = $_REQUEST["id"];
$sql = "SELECT
restaurant.restaurant_id,
restaurant.name AS rname,
cities.name AS cname,
restaurant.location,
restaurant.open_day,
restaurant.close_day,
restaurant.open_time,
restaurant.close_time,
restaurant.rating,
restaurant_style.restaurant_style_name,
restaurant.descrip,
restaurant.fee,
restaurant_style.restaurant_style_image AS image
FROM
restaurant
JOIN
cities ON restaurant.city_id = cities.id
JOIN
restaurant_style ON restaurant.restaurant_style_id = restaurant_style.restaurant_style_id
WHERE restaurant_id=".$id;
$result = $conn->query($sql);
$attractionDetail = array();
if ($result->num_rows > 0) {
while($row = $result->fetch_assoc()) {
$row["image"] = base64_encode($row["image"]);
$attractionDetail [] = $row;
}
} else {
$attractionDetail [] = "No result";
}
echo json_encode($attractionDetail);
?>