prepare("SELECT a_id, application_name FROM applications WHERE m_id = ?"); $stmt->bind_param("i", $m_id); $stmt->execute(); $result = $stmt->get_result(); $applications = []; while ($row = $result->fetch_assoc()) { $applications[] = $row; } header('Content-Type: application/json'); echo json_encode($applications); } ?>