<?
function getnumsex($y,$t,$m,$spid)
{
	include "connect.inc.php";
	$sqlgets = "select count(sex) as counts from biology inner join fishspecies on biology.spid = fishspecies.spid  inner join fishoperation on biology.Optid = fishoperation.Optid INNER JOIN ship ON fishoperation.VesselId = ship.ShipName";
	$sqlgets = $sqlgets." where year(DepartureDate) = '$y' and month(DepartureDate)='$m' and biology.spid='$spid' and sex='$t' ";
	//echo $sqlgets ."<br>"; 
	$qrygets = mysql_query($sqlgets );
	$resgets = mysql_fetch_array($qrygets);
	$counts =  $resgets["counts"];
	return $counts;
}
function getnumstage($y,$sid,$m,$spid)
{
	include "connect.inc.php";
	$sqlgetst = "select count(stageid) as cstage from biology inner join fishspecies on biology.spid = fishspecies.spid  inner join fishoperation on biology.Optid = fishoperation.Optid INNER JOIN ship ON fishoperation.VesselId = ship.ShipName";
	$sqlgetst = $sqlgetst." where year(DepartureDate) = '$y' and month(DepartureDate)='$m' and biology.spid='$spid' and stageid='$sid' ";
	//echo $sqlgetst ."<br>"; 
	$qrygetst = mysql_query($sqlgetst);
	$resgetst = mysql_fetch_array($qrygetst);
	$countst =  $resgetst["cstage"];
	return $countst;
}
?>
