<?php
include_once("database.php");

if($_SERVER['REQUEST_METHOD'] === 'GET')){
    $sql1 = "SELECT Now()";
    $currtime = $mysqli->query($sql1);
    $sql2 = "SELECT * FROM questions WHERE stime <= $currtime and etime >= $currtime";
    
    $data = [];
    if($result = mysqli->query($sql2)){
        while($row = mysql_fetch_assoc($request)){
            array_push($data,$row);
        }
        echo json_encode($data);
    }
    else{
        http_response_code(404);
    }
}

?>