<?php
include '../connection.php'; // Ensure this path is correct for your setup

header('Content-Type: application/json');

$sql = "SELECT ID, p_name, p_type, p_start, p_end, p_department, p_details FROM projects";
$result = $conn->query($sql);

$projects = [];
if ($result->num_rows > 0) {
    while ($row = $result->fetch_assoc()) {
        $projects[] = $row;
    }
}

echo json_encode($projects);
?>
