You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
33 lines
613 B
33 lines
613 B
<?php
|
|
@include 'config.php';
|
|
@include 'headers.php';
|
|
|
|
$conn = @mysqli_connect($CONF['DB']['HOST'], $CONF['DB']['USER'], $CONF['DB']['PASS'], 'weather')or die("CONNECTION ERROR");
|
|
|
|
$day = $_GET['day'];
|
|
|
|
$q = mysqli_query($conn, "SELECT * FROM `data` WHERE `date` LIKE '$day%'");
|
|
|
|
if($q) {
|
|
|
|
$list = array();
|
|
|
|
while($row = mysqli_fetch_assoc($q)) {
|
|
$list[] = $row;
|
|
}
|
|
|
|
http_response_code(200);
|
|
echo json_encode(array(
|
|
"status" => 200,
|
|
"items" => $list
|
|
));
|
|
|
|
} else {
|
|
http_response_code(400);
|
|
echo json_encode(array(
|
|
"status" => 400,
|
|
"message" => "Error executing query"
|
|
));
|
|
|
|
}
|
|
?>
|