I am trying to get JSON response from server but it's giving me
Parse error: syntax error, unexpected end of file in localhost\tourist\getPlaces.php on line 37
my init.php is working.
<?php
require "init.php";
function getCategories(){
// $db = new DbConnect();
// array for json response
$response = array();
$response["places"] = array();
// Mysql select query
$result = mysql_query("SELECT * FROM places");
if($result === FALSE) {
die(mysql_error("error message for the user"));
while($row = mysql_fetch_assoc($result)){
// temporary array to create single category
$tmp = array();
$tmp["id"] = $row['place_id'];
$tmp["type"] = $row['type'];
$tmp["thumbnail"] = $row['thumbnail'];
$tmp["name"] = $row['name'];
$tmp["city"] = $row['city'];
$tmp["description"] = $row['description'];
// push category to final json array
array_push($response["places"], $tmp);
}
// keeping response header to json
header('Content-Type: application/json');
// echoing json result
echo json_encode($response);
}
getCategories();
?>