-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcategory.php
More file actions
36 lines (32 loc) · 1.03 KB
/
Copy pathcategory.php
File metadata and controls
36 lines (32 loc) · 1.03 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
<?php
session_start();
include 'dbconn.php';
if (isset($_SESSION["category"])) {
$category = $_SESSION["category"];
} else {
$category = 0;
}
if (isset($_POST["category"])) {
$sql = "SELECT placeId FROM category WHERE cateId='$category' LIMIT 100";
$data = array();
$result = mysqli_query($conn, $sql);
if (mysqli_num_rows($result) > 0) {
while ($row = mysqli_fetch_assoc($result)) {
$placeid = $row["placeId"];
$query = "SELECT placeId,placename,thumbnail FROM places WHERE placeId='$placeid'";
$results = mysqli_query($conn, $query);
if (mysqli_num_rows($results) > 0) {
while ($rows = mysqli_fetch_assoc($results)) {
array_push($data, array("placeId" => $rows["placeId"], "placename" => $rows["placename"], "thumbnail" => $rows["thumbnail"]));
}
} else {
echo false;
}
}
echo json_encode($data);
} else {
echo false;
}
}
mysqli_close($conn);
?>