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

    function 
getResponsibleShiftData() {
        global 
$dbc;

        
$sql "SELECT User.pk_userID, User.email
                FROM citeLeParis_user AS User
                ORDER BY User.pk_userID 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);
    }

    
getResponsibleShiftData();
?>