<?php

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

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

if ($ce_id > 0) {
  $dal = new DAL();
  $sql = "SELECT id, " .
         "controlinstance_id, '' AS controlinstance_id_text, " . 
         "property,  property AS property_text, " .
         "value,     value AS value_text " .
         "FROM controlentry " .
         "WHERE id = $ce_id LIMIT 1 " ;
  $result = $dal->query($sql);
}

$_SESSION['controlentry'] = $ce_id;

echo json_encode($result);

?>

