<?php
// =====================================================
// GET /all_problem.php
// Response: JSON Array [ { id, title } ]
// =====================================================
require_once 'config.php';

$conn = getConnection();

$result = $conn->query("SELECT id, title FROM issue ORDER BY id ASC");

$issues = [];
while ($row = $result->fetch_assoc()) {
    $issues[] = [
        "id"    => (int)$row['id'],
        "title" => $row['title']
    ];
}

echo json_encode($issues);

$conn->close();
