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

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

if ($in_id > 0) {
  $dal = new DAL();
  $sql = "SELECT I.id,       type_id AS id_attr, " .
         "I.name,            '' AS name_attr, " .
         "I.exchange_id,     '' AS exchange_id_attr, " .
         "I.symbol,          '' AS symbol_attr, " .
         "I.type_id,         IT.class_id AS type_id_attr, " .
         "IT.class_id,       IC.group_id AS class_id_attr, " .
         "IC.group_id,       1 AS group_id_attr, " .
         "1 AS complete_ind, '' AS complete_ind_attr " .
         "FROM instrument I, instrumenttype IT, instrumentclass IC " .
         "WHERE I.id = $in_id AND IT.id = I.type_id AND IC.id = IT.class_id " .
         "LIMIT 1 " ;
  $result = $dal->query($sql);
}

$_SESSION['instrument'] = $in_id;

echo json_encode($result);

?>

