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

foreach ($_POST as $paramName => $paramValue) {
  if ($paramName == "selectid")
    $wo_id = $paramValue;
}

$dal = new DAL();

$sql = "SELECT id AS id, " . 
       "date AS fkid, textdate AS fkid_text " .
       "FROM workday WHERE id = '$wo_id' LIMIT 1 ";
$result = $dal->query($sql);

if (null === $result) {
  $sql = "SELECT 0 AS id, '' AS fkid, '' AS fkid_text " ;
  $result = $dal->query($sql);
}

echo json_encode($result);

?>

