home/abhiramc/public_html/acts.service/fetch_designations.php000064400000001421150211523050020476 0ustar00getConnection(); 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); } ?>