<?php

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

foreach ($_POST as $paramName => $paramValue) {
  if ($paramName == "baseid") 
    $pa_id = $paramValue;  
  if ($paramName == "scopeid") 
    $pw_id = $paramValue;  
  else if ($paramName == "rowval") 
    $op_name = $paramValue;  
}

$dal = new DAL();
         
$op_id = hexdec(uniqid());

$sql = "INSERT INTO operation " .
       "(id, name) " .
       "VALUES ($op_id, '$op_name') ";
$result = $dal->query($sql);

$pwo_id = hexdec(uniqid());

$sql = "INSERT INTO projectworkdayoperation (id, projectworkday_id, operation_id) " .
       "VALUES ($pwo_id, $pw_id, $op_id) ";
$result = $dal->query($sql);

echo json_encode($op_id);

?>

