���� ������������������������������������ setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); // Prepare the SQL query to fetch the `data` column for the given ClientPointId $stmt = $pdo->prepare(" SELECT data FROM webhookdata_1234 "); // Execute the query $stmt->execute(); // Fetch all rows as an associative array $rows = $stmt->fetchAll(PDO::FETCH_ASSOC); // Check if any data was found if (empty($rows)) { // Return a 404 error if no data is found http_response_code(404); // Not Found echo json_encode([ 'status' => 'error', 'message' => 'No data found for the provided ClientPointId.' ]); } else { // Extract the `data` column values and decode them from JSON $combinedData = []; foreach ($rows as $row) { $combinedData[] = json_decode($row['data'], true); } // Return the combined data in JSON format http_response_code(200); // OK echo json_encode([ 'status' => 'success', 'data' => $combinedData ]); } } catch (PDOException $e) { // Handle database errors http_response_code(500); // Internal Server Error echo json_encode([ 'status' => 'error', 'message' => 'Database error: ' . $e->getMessage() ]); } ?>