File: /home/barbeatleanalyti/www/api.beatleanalytics.com/basite/getlistbytype.php
<?php
$response = array();
// include db connect class
require_once '../db_connect.php';
// connecting to db
$db = new DB_CONNECT();
if (isset($_GET["type"])) {
$result = mysql_query("SELECT * FROM beatle_review WHERE restType = '".$type."' and status = 'Y' ")or die(mysql_error());
// check for empty result
if (mysql_num_rows($result) > 0) {
$response["data"] = array();
while ($row = mysql_fetch_object($result)) {
// temp user array
// $lists = array();
// $lists["indId"] = $row["IndId"];
// $lists["indName"] = $row["db_industry"];
// $lists["indLoginId"] = $row["db_IndLoginId"];
// $lists["pagesId"] = $row["db_pagesId"];
// $lists["keywordName"] = $row["keywordName"];
// $lists["indTypeId"] = $row["db_ind_type_id"];
array_push($response["data"], $row);
}
// success
$response["success"] = "true";
$response["message"] = "success";
// echoing JSON response
echo json_encode($response);
} else {
// no products found
$response["success"] = "false";
$response["message"] = "type not found";
// echo no users JSON
echo json_encode($response);
}
}else {
// required field is missing
$response["success"] = "false";
$response["message"] = "Required field(s) is missing";
// echoing JSON response
echo json_encode($response);
}
?>