<?
function InsertBiology($optid,$spid,$sid,$tl,$bl,$fl,$sl,$bw,$sex,$stage,$gw)
{
	include "connect.inc.php";
	$sqlInsertBiology = "insert into biology(Optid,spid,sid,tl,bl,fl,sl,bw,sex,stageid,gw) values($optid,$spid,$sid,$tl,$bl,$fl,$sl,$bw,'$sex',$stage,$gw)";
	//echo $sqlInsertBiology;
	mysql_query($sqlInsertBiology);
}
function EditBiology($optid,$spid,$sid,$tl,$bl,$fl,$sl,$bw,$sex,$stage,$gw)
{
	include "connect.inc.php";
	$sqlUpdateBiology = "update biology set tl=$tl,bl=$bl,fl=$fl,sl=$sl,bw=$bw,sex='$sex',stageid=$stage,gw=$gw where Optid=$optid and spid=$spid and sid=$sid";
	//echo $sqlUpdateBiology;
	mysql_query($sqlUpdateBiology);
}
function DeleteBiology($optid,$spid,$sid)
{
	include "connect.inc.php";
	$sqlDeleteBiology = "delete from biology where Optid=$optid and spid=$spid and sid=$sid";
	//echo $sqlDeleteBiology;
	//echo "<br>";
	mysql_query($sqlDeleteBiology);
	$updatesid = "update biology set sid=sid-1 where Optid=$optid and spid=$spid and sid > $sid";
	//echo $updatesid;
	//echo "<br>";
	mysql_query($updatesid);
}
function getsid($optid,$spid)
{
				include "connect.inc.php";
			  	$sqlgetid = "select max(sid) as bmax from biology where Optid=$optid and spid=$spid ";
				$qrygetid = mysql_query($sqlgetid);
				$resultgetid = mysql_fetch_array($qrygetid);
				$maxId = $resultgetid["bmax"];
				$bid = $maxId+1;
				return $bid;
}
?>