File: /home/barbeatleanalyti/public_html/api.beatleanalytics.com/customer/get_industry.php
<?php
/*
* Following code will get single department details
* A industry is identified by dept_id
*/
// array for JSON response
$response = array();
// include db connect class
require_once 'db_connect.php';
// connecting to db
$db = new DB_CONNECT();
// get a details from beatle_industry_type table
$result = mysql_query("SELECT * FROM beatle_industry_type")or die(mysql_error());
if (!empty($result)) {
// check for empty result
if (mysql_num_rows($result) > 0) {
$response["industryDetail"] = array();
while ($row = mysql_fetch_array($result)) {
$industryDetail = array();
$industryDetail["indtypeid"] = $row["indtypeid"];
$industryDetail["name"] = $row["name"];
// push single product into final response array
array_push($response["industryDetail"], $industryDetail);
}
// success
$response["success"] = 1;
// echoing JSON response
echo json_encode($response);
} else {
// no product found
$response["success"] = 0;
$response["message"] = "No industry type found";
// echo no users JSON
echo json_encode($response);
}
} else {
// no industry found
$response["success"] = 0;
$response["message"] = "No industry type found.";
// echo no users JSON
echo json_encode($response);
}
?>