extract($_REQUEST); include ("header.php"); include ("titlebartop.html"); echo "Find A Virus"; include ("titlebarbottom.html"); if($submit) { $where_clause=array(); //build Tnumber WHERE clause $array_length=sizeof($tnum); if ($array_length!=0){ $use_layers=", layers "; $tnums=array(); while ($r=each($tnum)){ array_push($tnums, "Tnum='$r[1]'"); } $tnum = implode(' OR ', $tnums); $tnum = "($tnum) AND layers.vipPDB = virus_info.vipPDB"; array_push($where_clause, $tnum); } //build Crystal System WHERE clause $array_length=sizeof($crys); if ($array_length!=0){ $use_xtal_table=", xtal_table "; $crysts=array(); while ($r=each($crys)){ array_push($crysts, "cryst_sys='$r[1]'"); } $crys = implode(' OR ', $crysts); $crys = "($crys) AND xtal_table.vipPDB = virus_info.vipPDB"; array_push($where_clause, $crys); } //build name WHERE clause if ($name_lookup){ if ($name_method==1) $name_search="name like '%$name_lookup%'"; elseif ($name_method==2) $name_search="name like '$name_lookup%'"; elseif ($name_method==3) $name_search="name like '%$name_lookup'"; else $name_search="name like '$name_lookup'"; array_push($where_clause, $name_search); } //build family WHERE clause if ($fam_lookup){ if ($fam_method==1) $fam_search="%$fam_lookup%"; elseif ($fam_method==2) $fam_search="$fam_lookup%"; elseif ($fam_method==3) $fam_search="%$fam_lookup"; else $fam_search="$fam_lookup"; array_push($where_clause, "family like '$fam_search'"); } //build family WHERE clause if ($gen_lookup){ if ($gen_method==1) $gen_search="%$gen_lookup%"; elseif ($gen_method==2) $gen_search="$gen_lookup%"; elseif ($gen_method==3) $gen_search="%$gen_lookup"; else $gen_search="$gen_lookup"; array_push($where_clause, "genus like '$gen_search'"); } //resolution clause if ($res1){ if (!$res2 || $res2=='----' || $res1==$res2) $res_query="res like '$res1%'"; else { if ($res1 > $res2) $res_query="res <= '$res1' AND res >= '$res2'"; else $res_query="res >= '$res1' AND res <= '$res2'"; } array_push($where_clause, $res_query); } //build entry_type clause if ($entry_type) array_push($where_clause, "entry_type = '$entry_type'"); //build space group clause if ($spgrp) array_push($where_clause, "spgroup = '$spgrp'"); $where = implode(" AND ", $where_clause); if (!$where){ echo "You didn't enter any search restrictions, go back and try again."; include("footer.html"); exit; } echo"
";
$results = mysql_query("SELECT virus_info.vipPDB, name FROM virus_info $use_layers $use_xtal_table
WHERE $where ORDER BY name");
$numrows = mysql_num_rows($results);
echo"";
if ($numrows != 0) {
echo "Search Results ";
if ($numrows==1) echo "(1 match):
|