<?php

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

foreach ($_POST as $paramName => $paramValue) {
  if ($paramName == "selid")
    $lo_id = $paramValue;
}

$dal = new DAL();

$sql = "SELECT I.id, I.descr AS text " .
       "FROM inclusion I, lotcompositioninclusion LCI, lotcomposition LC " .
       "WHERE LCI.inclusion_id = I.id AND LC.id = LCI.lotcomposition_id " .
       "AND LC.lot_id = $lo_id " .
       "ORDER BY descr ";
$result = $dal->query($sql);

echo json_encode($result);

?>

