<?php

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

foreach ($_POST as $paramName => $paramValue) {
  if ($paramName == "rowid") 
    $ph_id = $paramValue;  
  else if ($paramName == "time_taken") 
    $time_taken = $paramValue;  
  else if ($paramName == "cardinal_id") 
    $cardinal_id = $paramValue;  
  else if ($paramName == "location") 
    $location = $paramValue;  
  else if ($paramName == "phototag_id") 
    $phototag_id = $paramValue;  
  else if ($paramName == "note") 
    $note = $paramValue;  
}

$dal = new DAL();
$sql = "UPDATE photo " .
       "SET time_taken='$time_taken', cardinal_id=$cardinal_id, " .
       "location='$location', phototag_id=$phototag_id, note='$note' " .
       "WHERE id = $ph_id ";
$result = $dal->query($sql);
    
echo json_encode($result);

?>

