<?php require_once('../../Connections/conn_ama.php'); 
	include("../../../../../../../functions/functions.php");    
	    
	if (!isset($_SESSION)) {
	  session_start();
	}

	//$curr_season = $_SESSION['curr_season'];
	//$curr_season = '2019/2020';	
	
//echo $_POST["MM_insert"];
 /* echo $_POST['subsubdeptname'];
 echo $_POST['subsubdeptfunctions']; */

if ((isset($_POST['MM_update'])) && ($_POST['MM_update'] == "update-unit-details")) {
	
	
        $insertSQL = sprintf("UPDATE deptsub2, deptsub2contact dc
                              LEFT JOIN deptsub2 dd ON dd.subsubdeptID = dc.subsubdeptID
                              SET dd.subsubdeptname=%s, dd.subsubdeptfunctions=%s, dc.phone=%s, dc.email=%s WHERE dd.subsubdeptID = %s",

            GetSQLValueString($_POST['subsubdeptname'], "text"),
            GetSQLValueString($_POST['subsubdeptfunctions'], "text"),
            GetSQLValueString($_POST['phone'], "text"),
            GetSQLValueString($_POST['email'], "text"),
            GetSQLValueString($_POST['MM_unitID'], "int"));

    $Result1 = mysqli_query($conn_ama, $insertSQL) or die(mysqli_error($conn_ama));
    //$lawyerID = mysqli_insert_id($conn_ama);
    
    if($Result1){

        $result = "datasent";
        echo $result;
    }
    else{
      echo "notsent";
    }

}
		
		
?>