<?php
include("../../db.php");
header('Content-Type: application/json');

$status = 0;
$msg = "Unable to fetch data..! Please retry later";
$data = array();

$result = $db->getRows("SELECT name FROM department");

if ($result){
    $status = 1;

    foreach ($result as $row){
        $data[] = $row['name'];
    }

    $msg = "Record found";
}else{
    $msg = "Record not found";
}

echo json_encode(array("status" => $status, "data" => $data, "msg" => $msg));

