$sql = "UPDATE trn_museum_profile_picture SET  " . implode(",", $update) . " WHERE PIC_ID =" . $k;
			mysql_query($sql, $conn) or die($sql);
		}
	}

	// แหล่งเรียนรู้ใกล้เคียง = 9 NEARBY
	if (count($_POST['NEARBY_file']) > 0) {
		$sql_max = "SELECT MAX(ORDER_DATA) AS MAX_ORDER FROM trn_museum_profile_picture WHERE MUSEUM_ID = " . $_POST['museumId'] . " AND IMG_TYPE = 9";
		$query_max = mysql_query($sql_max, $conn) or die($sql_max);
		$row_max = mysql_fetch_array($query_max);
		$max = $row_max['MAX_ORDER'];
		$max++;

		foreach ($_POST['NEARBY_file'] as $k => $file) {
			$filename = frontend_move_image_upload_dir('MUSEUM_' . $_POST['museumId'], end(explode('/', $file)), 1000, '', false, 150, 150);

			unset($insert);
			$insert['MUSEUM_ID'] = $_POST['museumId'];
			$insert['IMG_TYPE'] = 9;
			$insert['IMG_PATH'] = "'" . $filename . "'";
			$insert['ORDER_DATA'] = $max++;

			$sql = "INSERT INTO trn_museum_profile_picture (" . implode(",", array_keys($insert)) . ") VALUES (" . implode(",", array_values($insert)) . ")";
			mysql_query($sql, $conn) or die($sql);
		}
	}

	if (count($_POST['NEARBYorder_position']) > 0) {

		foreach ($_POST['NEARBYorder_position'] as $k => $val) {
 $insert['EVENT_START_TIME'] = "'" . $_POST['startdate'] . "'";
 $insert['EVENT_END_TIME'] = "'" . $_POST['enddate'] . "'";
 $insert['PRICE_RATE_LOC'] = "'" . $_POST['txtPriceLoc'] . "'";
 $insert['PRICE_RATE_ENG'] = "'" . $_POST['txtPriceEng'] . "'";
 $sql = "INSERT INTO  trn_content_detail (" . implode(",", array_keys($insert)) . ") VALUES (" . implode(",", array_values($insert)) . ")";
 mysql_query($sql, $conn) or die($sql . ' Err : ' . mysql_error());
 $retrunID = mysql_insert_id();
 if (count($_POST['EVENT_PIC_file']) > 0) {
     $sql_max = "SELECT MAX(ORDER_ID) AS MAX_ORDER FROM trn_content_picture WHERE CONTENT_ID = " . $retrunID . " AND IMG_TYPE = 1 ";
     //$_POST['cmbCategory'];
     $query_max = mysql_query($sql_max, $conn) or die($sql_max);
     $row_max = mysql_fetch_array($query_max);
     $max = $row_max['MAX_ORDER'];
     $max++;
     foreach ($_POST['EVENT_PIC_file'] as $k => $file) {
         $filename = frontend_move_image_upload_dir('content_museum_' . $retrunID, end(explode('/', $file)), 1000, '', false, 150, 150);
         unset($insert);
         $insert['CONTENT_ID'] = $retrunID;
         $insert['IMG_TYPE'] = 1;
         $insert['IMG_PATH'] = "'" . $filename . "'";
         $insert['CAT_ID'] = "'" . $CID . "'";
         $insert['ORDER_ID'] = "'" . $max++ . "'";
         $sql = "INSERT INTO trn_content_picture (" . implode(",", array_keys($insert)) . ") VALUES (" . implode(",", array_values($insert)) . ")";
         mysql_query($sql, $conn) or die;
     }
 }
 // $IMG_TYPE = 3;
 if (count($_POST['YOUTUBE_file'])) {
     $sql_max = "SELECT MAX(ORDER_ID) AS MAX_ORDER FROM trn_content_picture WHERE CONTENT_ID = " . $retrunID . " AND IMG_TYPE = 3 ";
     $query_max = mysql_query($sql_max, $conn) or die($sql_max);
     $row_max = mysql_fetch_array($query_max);
	 แหล่งเรียนรู้ใกล้เคียง = 9 NEARBY
	 */
	$arrPic = array("", "HIS", "PHY", "LAND", "EXH", "ARC", "TOP_ARC", "STORAGE", "PUBLIC_INFO", "NEARBY");

	for ($idx = 1; $idx <= 9; $idx++) {
		//ความเป็นมา Type = 1 HIS
		if (count($_POST[$arrPic[$idx] . '_file']) > 0) {
			$sql_max = "SELECT MAX(ORDER_DATA) AS MAX_ORDER FROM trn_museum_profile_picture WHERE MUSEUM_ID = " . $returnID . " AND IMG_TYPE = " . $idx;
			//$_POST['cmbCategory'];
			$query_max = mysql_query($sql_max, $conn) or die($sql_max);
			$row_max = mysql_fetch_array($query_max);
			$max = $row_max['MAX_ORDER'];
			$max++;

			foreach ($_POST[$arrPic[$idx] . '_file'] as $k => $file) {
				$filename = frontend_move_image_upload_dir('MUSEUM_' . $returnID, end(explode('/', $file)), 1000, '', false, 150, 150);

				unset($insert);
				$insert['MUSEUM_ID'] = $returnID;
				$insert['IMG_TYPE'] = $idx;
				$insert['IMG_PATH'] = "'" . $filename . "'";
				$insert['ORDER_DATA'] = $max++;

				$sql = "INSERT INTO trn_museum_profile_picture (" . implode(",", array_keys($insert)) . ") VALUES (" . implode(",", array_values($insert)) . ")";
				mysql_query($sql, $conn) or die($sql);
			}
		}
	}

	if (isset($_POST['catMuseum'])) {
		$sql = "delete from trn_mapping_museum_category where MUSEUM_DETAIL_ID = " . $returnID;