<?php

require_once($_SERVER['DOCUMENT_ROOT'] . '/sys/db.php');

foreach ($_POST as $paramName => $paramValue) {
  if ($paramName == "scopeid")
    $lw_id = $paramValue;
}    
 
$dal = new DAL();
$sql = "SELECT WE.id as id, start_time, CL.name AS cloud , AT.descr AS atmosphere, " .
       "temperature, humidity, LI.descr AS Lighting, PR.descr AS precipitation " .
       "FROM weather WE, cloudcover CL, atmosphere AT, precipitation PR, lighting LI " .
       "WHERE WE.loginworkday_id = $lw_id AND WE.active = 1 " .
       "AND WE.cloudcover_id = CL.id AND WE.atmosphere_id = AT.id " . 
       "AND WE.precipitation_id = PR.id AND LI.id = WE.lighting_Id " .
       "ORDER BY WE.id ";
$result = $dal->query($sql);

echo json_encode($result);

?>

