File: /home/barbeatleanalyti/public_html/api.beatleanalytics.com/live/deptid.php
<?php
/*
* Following code will list all the products
*/
// array for JSON response
$response = array();
// include db connect class
require_once 'db_connect.php';
// connecting to db
$db = new DB_CONNECT();
// get all products from products table
$result = mysql_query("SELECT *FROM beatle_industry") or die(mysql_error());
// check for empty result
if (mysql_num_rows($result) > 0) {
// looping through all results
// products node
$response["beatle_industry"] = array();
while ($row = mysql_fetch_array($result)) {
// temp user array
$deptDetail = array();
$deptDetail["db_IndLoginId"] = $row["db_IndLoginId"];
$deptDetail["ind_id"] = $row["IndId"];
$deptDetail["ind_name"] = $row["db_industry"];
// push single product into final response array
array_push($response["beatle_industry"], $deptDetail);
}
// success
$response["success"] = 1;
// echoing JSON response
echo json_encode($response);
} else {
// no products found
$response["success"] = 0;
$response["message"] = "No deptId found";
// echo no users JSON
echo json_encode($response);
}
?>