<?
function InsertDistrict($disid,$disname)
{
	include "connect.inc.php";
	$sqlchk = "select * from district where disname='$disname'";
	//echo $sqlchk;
	$qrychk = mysql_query($sqlchk);
	$numchk = mysql_num_rows($qrychk);
	if($numchk < 1)
	{
	$sqlinsert = "insert district(disid,disname) values($disid,'$disname')";
	//echo $sqlinsert;
	mysql_query($sqlinsert);
	}
	else
	{
	require_once("usr_function.php");
	ErrMsg("District is duplicate!");
	}
}
function EditDistrict($disid,$disname)
{
	include "connect.inc.php";
	$sqlchk = "select * from district where disname='$disname' and disid !=$disid ";
	//echo $sqlchk;
	$qrychk = mysql_query($sqlchk);
	$numchk = mysql_num_rows($qrychk);
	if($numchk < 1)
	{
	$sqledit = "update district set disname='$disname' where disid='$disid'";
	//echo $sqledit;
	mysql_query($sqledit) or die(mysql_error());
	}
	else
	{
	require_once("usr_function.php");
	ErrMsg("District is duplicate!");
	}
}
function DeleteDistrict($districtid)
{
	include "connect.inc.php";
	$sqldelete = "delete from district where disid=$districtid";
	//echo $sqldelete;
	mysql_query($sqldelete) or die(mysql_error());
}
?>