home/abhiramc/public_html/acts.service/fetch_designations.php 0000644 00000001421 15021152305 0020476 0 ustar 00 getConnection();
if (isset($_GET['branch_id'])) {
$branch_id = $_GET['branch_id'];
// Query to fetch designations based on the branch ID
$query = "SELECT dg_id, dg_name FROM acts_designation WHERE branch_id = :branch_id";
$stmt = $db->prepare($query);
$stmt->bindParam(':branch_id', $branch_id, PDO::PARAM_INT);
$stmt->execute();
// Prepare the result as an array
$designations = [];
if ($stmt->rowCount() > 0) {
while ($row = $stmt->fetch(PDO::FETCH_ASSOC)) {
$designations[] = $row; // Add each designation to the array
}
}
// Return the JSON response
echo json_encode($designations);
}
?>