<TITLE>Leptospira Classification</TITLE>

<!
includeFile("body.html");
includeFile("../text&html/head.html");
>

<CENTER>
<IMG SRC="../pictures/subhead-class.gif">
</CENTER>

<!

/*- ---------------------------------------------------------------------- -*/
/*- Open connection to database and SELECT data from tables		   -*/
/*- ---------------------------------------------------------------------- -*/
$sock = msqlConnect();
if ($sock < 0) {
   printf("<BR><BR><BR><CENTER><TABLE><TR><TD><B><FONT SIZE=3>%s</FONT></TD></TR></TABLE>\n", $ERRMSG);
   fatal("");
   }
if (msqlSelectDB($sock,"leptospira") < 0) {
   printf("<BR><BR><BR><CENTER><TABLE><TR><TD><B><FONT SIZE=3>%s</FONT></TD></TR></TABLE>\n", $ERRMSG);
   fatal("");
   }

if ($serovar=="") {
   echo("<BR><CENTER>This program can not be called without parameters.<BR><P>\n");
   includeFile("../text&html/to-top1.txt");
   exit(0);
   }
$srch="SELECT * FROM serovars WHERE serovar CLIKE '$serovar'";

/*- ---------------------------------------------------------------------- -*/
/*- Connected to mSQL server, now try to send SELECT query to database     -*/
/*- ---------------------------------------------------------------------- -*/
if (msqlQuery($sock, $srch)<0) {
   printf("<BR><BR><BR><CENTER><TABLE><TR><TD><B><FONT SIZE=3>%s</FONT></TD></TR></TABLE>\n", $ERRMSG);
   fatal("");
   } 

$results=msqlStoreResult();
$data=msqlFetchRow($results);
msqlFreeResult($result);

if (#$data>0) {
echo("<HR WIDTH=100%>\n");
echo("<TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0>\n");
echo("<TR><TD WIDTH=100>GENUS</TD><TD><FONT FACE=\"Arial, Helvetica\"><I>$data[0]<I></FONT></TD></TR>\n");
echo("<TR><TD>SPECIES</TD><TD><FONT FACE=\"Arial, Helvetica\"><I>$data[1]</I></FONT></TD></TR>\n");
echo("<TR><TD>SEROGROUP</TD><TD><FONT FACE=\"Arial, Helvetica\"><I>$data[2]</I></FONT></TD></TR>\n");
echo("<TR><TD>SEROVAR</TD><TD><FONT FACE=\"Arial, Helvetica\"><B><I>$data[3]</I></B></FONT></TD></TR>\n");
echo("<TR><TD>STRAIN</TD><TD><FONT FACE=\"Arial, Helvetica\">$data[4]</FONT></TD></TR>\n");
echo("<TR><TD>YEAR</TD><TD><FONT FACE=\"Arial, Helvetica\">$data[5]</FONT></TD></TR>\n");
echo("<TR><TD>ORIGIN</TD><TD><FONT FACE=\"Arial, Helvetica\">$data[6]</FONT></TD></TR>\n");
echo("<TR><TD>COUNTRY</TD><TD><FONT FACE=\"Arial, Helvetica\">$data[7]</FONT></TD></TR>\n");
echo("<TR><TD>STATUS</TD><TD><FONT FACE=\"Arial, Helvetica\">$data[8]</FONT></TD></TR>\n");
echo("</TABLE>\n<P></P>\n");

echo("<TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0>\n");
echo("<TR><TD COLSPAN=2><P></TD></TR><TR><TD COLSPAN=2><B>HISTORY:</B></TD>\n<TR><TD COLSPAN=2>\n");
$hist=split($data[9], "#");
$i=0; $max=#$hist;
while($i<$max) {
   echo("$hist[$i]<BR>\n");
   $i=$i + 1;
}
echo("</TD></TR>\n");
echo("</TABLE>\n");



if (msqlQuery($sock, "SELECT * FROM monoclonals WHERE serovar CLIKE '$serovar'")<0) {
   printf("<BR><BR><BR><CENTER><TABLE><TR><TD><B><FONT SIZE=3>%s</FONT></TD></TR></TABLE>\n", $ERRMSG);
   fatal("");
   } 

$results=msqlStoreResult();
$data=msqlFetchRow($results);


$i=0; $max=(real)0;
while (#$data>0) {
   $monoclonal[$i]=$data[0];
   $titar[$i]=(real)$data[2];
   if ($titar[$i]>$max) {
      $max=$titar[$i];
      }
   $i=$i + 1;
   $data=msqlFetchRow($results);
}
msqlFreeResult($results);
$n=$i;

if ($i>0) {
echo("<P></P>\n<CENTER><B>Monoclonal histogram</B>\n");

echo("<TABLE CELLSPACING=0 CELLPADDING=0 BORDER=0>\n");
$tblwdth=450;
$i=0;
while($i<$n) {
   if ($max>0) { 
      $sirina=(int)(($tblwdth/$max)*$titar[$i]);
      }
   else {
      $sirina=1;
      }
   $slk="monocl-1.gif";
   if ($titar[$i]>=$max) {
      $slk="monocl-2.gif";
      }
   echo("<TR><TD WIDTH=40 ALIGN=RIGHT>$monoclonal[$i]</TD><TD><IMG SRC=\"../pictures/none.gif\" WIDTH=5></TD><TD WIDTH=1 BGCOLOR=BLACK><IMG SRC=\"../pictures/none.gif\" BORDER=0 WIDTH=1></TD><TD><IMG SRC=\"../pictures/$slk\" WIDTH=$sirina HEIGHT=10>&nbsp $titar[$i]</TD></TR>\n");
   $i=$i + 1;
}
echo("<TR><TD COLSPAN=2></TD><TD COLSPAN=2 BGCOLOR=BLACK><IMG SRC=\"../pictures/none.gif\" HEIGHT=1 WIDTH=$tblwdth></TD></TR>\n");
echo("</TABLE>\n");

echo("<P></P>\n");
}

echo("<HR WIDTH=100%>\n");

} else {
   echo("Sorry, serovar that you are trying find, does not exist in our database.<BR>\n");
}


includeFile("../text&html/to-top1.txt");

msqlClose($sock);

>
