<?php
    header
('Content-Type: application/json');
    require_once 
'../DB/db_credentials.php';
    require_once 
'../DB/db_connection.php';

    function 
getExtraShiftData() {
        global 
$dbc;

        
$sql "SELECT Extra.pk_extra, Extra.name 
                FROM citeLeParis_extra AS Extra
                ORDER BY Extra.pk_extra ASC"
;

        
$result mysqli_query($dbc$sql);

        if (!
$result) {
            
http_response_code(500);
            echo 
json_encode([
                
'error' => 'Database query failed',
                
'details' => mysqli_error($dbc)
            ]);
            
mysqli_close($dbc);
            exit;
        }

        
$rows = [];
        while (
$row mysqli_fetch_assoc($result)) {
            
$rows[] = $row
        }

        
mysqli_free_result($result);
        
mysqli_close($dbc);

        
http_response_code(200);
        echo 
json_encode($rows);
    }

    
getExtraShiftData();
?>