<?php
	session_start();

	$brancode = $_POST['brch1'];
	$branname = $_POST['brch2'];
	$brancomid = $_POST['brch3'];
	$userlogin = $_SESSION['userloginname'];

	//echo "{$brancode},{$branname},{$brancomid},{$userlogin}";

	include "../../../Connections/connect_mysql.php";
	//mysql_query("set names utf8");


	$sql_s = "SELECT * FROM branch_tb  where brancode='{$brancode}' ";
	$result_s = mysql_query($sql_s) or die(mysql_error());
	if (mysql_num_rows($result_s)==0){
		$sql = " INSERT INTO branch_tb (brancode, branname, branmark, brancomid, brancreateby, brancreatetime, branupdateby, branupdatetime, branstatus) "; 
		$sql .=  " VALUES ('{$brancode}', '{$branname}', '-', '{$brancomid}', '{$userlogin}', NOW(), '{$userlogin}', NOW(), 'Y')";

		$result = mysql_query($sql) or die(mysql_error());

		echo "Y";

	}else{

		echo "N";
	}

	mysql_close($c);

 ?>
