home/abhiramc/public_html/acts.service/fetch_locations.php000064400000001400150211511640020001 0ustar00getConnection(); if (isset($_GET['branch_id'])) { $branch_id = $_GET['branch_id']; // Query to fetch locations based on the branch ID $query = "SELECT lo_id, lo_name FROM acts_location 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 $locations = []; if ($stmt->rowCount() > 0) { while ($row = $stmt->fetch(PDO::FETCH_ASSOC)) { $locations[] = $row; // Add each locations to the array } } // Return the JSON response echo json_encode($locations); } ?>