-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtestCall.php
More file actions
36 lines (30 loc) · 794 Bytes
/
testCall.php
File metadata and controls
36 lines (30 loc) · 794 Bytes
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
include 'db/db_connect.php';
//Query to select movie id and movie name
$query = "SELECT country, city FROM basedata";
$result = array();
$cityArray = array();
$response = array();
//Prepare the query
if($stmt = $con->prepare($query)){
$stmt->execute();
//Bind the fetched data to $movieId and $movieName
$stmt->bind_result($movieId,$movieName);
//Fetch 1 row at a time
while($stmt->fetch()){
//Populate the movie array
$cityArray["city"] = $cityId;
$cityArray["movie_name"] = $movieName;
$result[]=$cityArray;
}
$stmt->close();
$response["success"] = 1;
$response["data"] = $result;
}else{
//Some error while fetching data
$response["success"] = 0;
$response["message"] = mysqli_error($con);
}
//Display JSON response
echo json_encode($response);
?>