Sequence Alignment and Location Tracking
Report: DOC | PDF  

		$host = "";
		$user = "";
		$password = "";
		 
		mysql_connect($host, $user, $password);
		mysql_select_db("radianse");
		$query = "select * from patienttable where patienttypecode = 3 order by patienttableindex desc";
		$needle_pats = mysql_query($query);
		$num_needle_pats = mysql_num_rows($needle_pats);

		//for loop selects out the needle loc patients
		for ($i=0; $i < $num_needle_pats; $i++)
		{
			$needle_pat = mysql_fetch_array($needle_pats);
				echo "<div class=container>";
				echo "<div class=name>".substr($needle_pat["LastName"], 0 , 3).", ".substr($needle_pat["FirstName"], 0, 2)."</div>";
//			echo "<div class=name>".$needle_pat["LastName"].", ".$needle_pat["FirstName"]."<br>ID:".$needle_pat["PatientTableIndex"]."</div>";
			
			$query = "select distinct t1.sessionnumber, t2.description as location, t1.event, t3.description, t1.eventtime from 
			lightpakeventtable as t1, lanpaktable as t2, systemeventtable as t3, sessiontable as t4, 
			persontable as t5 where t1.lanpakindex=t2.lanpakindex and t1.event=t3.systemevent 
			and t1.sessionnumber=t4.sessionnumber and t4.personindex=t5.personindex and 
			t5.patienttableindex=".$needle_pat["PatientTableIndex"]." and t1.event in (2,1,3,16,6,7,21,22)";
			$needle_pats_info = mysql_query($query);
			$num_needle_pats_info = mysql_num_rows($needle_pats_info);
			
			echo "<table width=100% cellspacing=0>";
			$alternate=0;
			$location=NULL;
			//for loop prints out info for each needle loc patient
			for ($j=0; $j < $num_needle_pats_info; $j++)
			{
				$needle_pat_info = mysql_fetch_array($needle_pats_info);
				if ( $location == $needle_pat_info["location"] && $description == $needle_pat_info["description"] )
				{ }
				else
				{
					if ($alternate == 0) { 
						echo "<tr class=d0>";
						$alternate++;
						}
					else {
						echo "<tr class=d1>";
						$alternate--;
						}
					echo "<td class=location>".$needle_pat_info["location"]."</td>";
					echo "<td class=event>".$needle_pat_info["description"]."</td>";
					echo "<td class=time>".$needle_pat_info["eventtime"]."</td></tr>";
//					echo "<div class=location>".$needle_pat_info["location"]."</div>";
//					echo "<div class=event>".$needle_pat_info["description"]."</div>";
//					echo "<div class=time>".$needle_pat_info["eventtime"]."</div><br>";
//					echo $needle_pat_info["location"]."--".$needle_pat_info["description"]."--".$needle_pat_info["eventtime"]."<br>";
				}
				$location = $needle_pat_info["location"];
				$description = $needle_pat_info["description"];
			}
			
			echo "</table>";
			
			$location = null;
			$description = null;
			echo "</div><p>";
		}