<?php
error_reporting(E_ERROR);
$username="corey";
$password="41945549";
$database="controls";

mysql_connect('127.0.0.1',$username,$password);
@mysql_select_db($database) or die( "Unable to select database");
$query = "(SELECT * FROM boilers ORDER BY id DESC LIMIT 1)"; 
$result=mysql_query($query);

$num=mysql_numrows($result);

mysql_close();
?>

<?php
$i=0;
while ($i < $num) {
$f103=mysql_result($result,$i,"boiler7drumlvla");
$f104=mysql_result($result,$i,"boiler7drumlvlb");
$f105=mysql_result($result,$i,"boiler7drumlvlc");
$f106=mysql_result($result,$i,"boiler7lvl");
$f107=mysql_result($result,$i,"boiler7drumpress");
$f108=mysql_result($result,$i,"boiler7feedwater");
$f111=mysql_result($result,$i,"boiler7feedwaterpres");
$f109=mysql_result($result,$i,"boiler7steamflow");
$f110=mysql_result($result,$i,"boiler7livesteam");
$f112=mysql_result($result,$i,"boiler7idfanspd");

$f120=mysql_result($result,$i,"boiler8drumlvla");
$f121=mysql_result($result,$i,"boiler8drumlvlb");
$f122=mysql_result($result,$i,"boiler8drumlvlc");
$f123=mysql_result($result,$i,"boiler8lvl");
$f124=mysql_result($result,$i,"boiler8drumpress");
$f125=mysql_result($result,$i,"boiler8feedwater");
$f126=mysql_result($result,$i,"boiler8feedwaterpres");
$f127=mysql_result($result,$i,"boiler8steamflow");
$f128=mysql_result($result,$i,"boiler8livesteam");
$f129=mysql_result($result,$i,"boiler8idfanspd");
?>

<!-- vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv BOILERS vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv -->
<table class="tftable6" border="1">
		<tr>
			<td colspan="3" bgcolor="#121211" align="center" width="50%" style="color:#00BFFF; font-size: 60px;"><b><i>BOILER 7</i></b></td>
			<td colspan="3" bgcolor="#121211" align="center" width="50%" style="color:#00BFFF; font-size: 60px;"><b><i>BOILER 8</i></b></td>		
		</tr>
		<tr>
			<td bgcolor="#121211" align="left" style="color:#e0e0e0; font-size: 60px;">Drum LVL A</td>
			<td width="350" bgcolor="#242424" align="center" style="color:green; font-size: 60px;"><?php echo $f103; ?></td>
			<td bgcolor="#121211" align="left" style="color:#e0e0e0; font-size: 60px;">%</td>
			<td bgcolor="#121211" align="left" style="color:#e0e0e0; font-size: 60px;">Drum LVL A</td>
			<td width="350" bgcolor="#242424" align="center" style="color:green; font-size: 60px;"><?php echo $f120; ?></td>	
			<td bgcolor="#121211" align="left" style="color:#e0e0e0; font-size: 60px;">%</td>			
		</tr>
		<tr>
			<td bgcolor="#121211" align="left" style="color:#e0e0e0; font-size: 60px;">Drum LVL B</td>
			<td width="350" bgcolor="#242424" align="center" style="color:green; font-size: 60px;"><?php echo $f104; ?></td>
			<td bgcolor="#121211" align="left" style="color:#e0e0e0; font-size: 60px;">%</td>
			<td bgcolor="#121211" align="left" style="color:#e0e0e0; font-size: 60px;">Drum LVL B</td>
			<td width="350" bgcolor="#242424" align="center" style="color:green; font-size: 60px;"><?php echo $f121; ?></td>	
			<td bgcolor="#121211" align="left" style="color:#e0e0e0; font-size: 60px;">%</td>			
		</tr>
		<tr>
			<td bgcolor="#121211" align="left" style="color:#e0e0e0; font-size: 60px;">Drum LVL C</td>
			<td width="350" bgcolor="#242424" align="center" style="color:green; font-size: 60px;"><?php echo $f105; ?></td>
			<td bgcolor="#121211" align="left" style="color:#e0e0e0; font-size: 60px;">%</td>
			<td bgcolor="#121211" align="left" style="color:#e0e0e0; font-size: 60px;">Drum LVL C</td>
			<td width="350" bgcolor="#242424" align="center" style="color:green; font-size: 60px;"><?php echo $f122; ?></td>		
			<td bgcolor="#121211" align="left" style="color:#e0e0e0; font-size: 60px;">%</td>		
		</tr>
		<tr>
			<td bgcolor="#121211" align="left" style="color:#e0e0e0; font-size: 60px;">Drum LVL Avg</td>
			<td width="350" bgcolor="#242424" align="center" style="color:#00d145; font-size: 60px;"><?php echo $f106; ?></td>
			<td bgcolor="#121211" align="left" style="color:#e0e0e0; font-size: 60px;">%</td>
			<td bgcolor="#121211" align="left" style="color:#e0e0e0; font-size: 60px;">Drum LVL Avg</td>
			<td width="350" bgcolor="#242424" align="center" style="color:#00d145; font-size: 60px;"><?php echo $f123; ?></td>
			<td bgcolor="#121211" align="left" style="color:#e0e0e0; font-size: 60px;">%</td>				
		</tr>
		<tr>
			<td bgcolor="#121211" align="left" style="color:#e0e0e0; font-size: 60px;">Drum Pressure</td>
			<td width="350" bgcolor="#242424" align="center" style="color:yellow; font-size: 60px;"><?php echo $f107; ?></td>
			<td bgcolor="#121211" align="left" style="color:#e0e0e0; font-size: 60px;">Psig</td>
			<td bgcolor="#121211" align="left" style="color:#e0e0e0; font-size: 60px;">Drum Pressure</td>
			<td width="350" bgcolor="#242424" align="center" style="color:yellow; font-size: 60px;"><?php echo $f124; ?></td>
			<td bgcolor="#121211" align="left" style="color:#e0e0e0; font-size: 60px;">Psig</td>				
		</tr>
		<tr>
			<td bgcolor="#121211" align="left" style="color:#e0e0e0; font-size: 60px;">Live Steam Pressure</td>
			<td width="350" bgcolor="#242424" align="center" style="color:orange; font-size: 60px;"><?php echo $f110; ?></td>
			<td bgcolor="#121211" align="left" style="color:#e0e0e0; font-size: 60px;">psi</td>
			<td bgcolor="#121211" align="left" style="color:#e0e0e0; font-size: 60px;">Live Steam Pressure</td>
			<td width="350" bgcolor="#242424" align="center" style="color:orange; font-size: 60px;"><?php echo $f128; ?></td>
			<td bgcolor="#121211" align="left" style="color:#e0e0e0; font-size: 60px;">psi</td>				
		</tr>
		<tr>
			<td bgcolor="#121211" align="left" style="color:#e0e0e0; font-size: 60px;">Feed Water Pressure</td>
			<?php
				$color = "#FFFFFF";
		
				if (($f111 >= 0) && ($f111 <= 290))
				$color = "#FF0000";
				else if (($f111 >= 290) && ($f111 <= 300))
				$color = "#FFFF00";
				else if ($f111 >= 300)
				$color = "#00d145";
		
				echo "<td bgcolor=\"#242424\" align=\"center\" width=\"75\" style=\"color:$color; font-size: 60px;\"><b> $f111 </b></font></td>";
			?>
			<td bgcolor="#121211" align="left" style="color:#e0e0e0; font-size: 60px;">Psig</td>
			<td bgcolor="#121211" align="left" style="color:#e0e0e0; font-size: 60px;">Feed Water Pressure</td>
			<?php
				$color = "#FFFFFF";
		
				if (($f126 >= 0) && ($f126 <= 290))
				$color = "#FF0000";
				else if (($f126 >= 290) && ($f126 <= 300))
				$color = "#FFFF00";
				else if ($f126 >= 300)
				$color = "#00d145";
		
				echo "<td bgcolor=\"#242424\" align=\"center\" width=\"75\" style=\"color:$color; font-size: 60px;\"><b> $f126 </b></font></td>";
			?>
			<td bgcolor="#121211" align="left" style="color:#e0e0e0; font-size: 60px;">Psig</td>				
		</tr>
		<tr>
			<td bgcolor="#121211" align="left" style="color:#e0e0e0; font-size: 60px;">Feed Water Flow</td>
			<td width="350" bgcolor="#242424" align="center" style="color:#19afff; font-size: 60px;"><?php echo $f108; ?></td>
			<td bgcolor="#121211" align="left" style="color:#e0e0e0; font-size: 60px;">kpph</td>
			<td bgcolor="#121211" align="left" style="color:#e0e0e0; font-size: 60px;">Feed Water Flow</td>
			<td width="350" bgcolor="#242424" align="center" style="color:#19afff; font-size: 60px;"><?php echo $f125; ?></td>
			<td bgcolor="#121211" align="left" style="color:#e0e0e0; font-size: 60px;">kpph</td>				
		</tr>
		<tr>
			<td bgcolor="#121211" align="left" style="color:#e0e0e0; font-size: 60px;">Steam Flow</td>
			<td width="350" bgcolor="#242424" align="center" style="color:white; font-size: 60px;"><?php echo $f109; ?></td>
			<td bgcolor="#121211" align="left" style="color:#e0e0e0; font-size: 60px;">kpph</td>
			<td bgcolor="#121211" align="left" style="color:#e0e0e0; font-size: 60px;">Steam Flow</td>
			<td width="350" bgcolor="#242424" align="center" style="color:white; font-size: 60px;"><?php echo $f127; ?></td>
			<td bgcolor="#121211" align="left" style="color:#e0e0e0; font-size: 60px;">kpph</td>				
		</tr>
		<tr>
			<td bgcolor="#121211" align="left" style="color:#e0e0e0; font-size: 60px;">ID Fan Speed</td>
			<td width="350" bgcolor="#242424" align="center" style="color:white; font-size: 60px;"><?php echo $f112; ?></td>
			<td bgcolor="#121211" align="left" style="color:#e0e0e0; font-size: 60px;">RPM</td>
			<td bgcolor="#121211" align="left" style="color:#e0e0e0; font-size: 60px;">ID Fan Speed</td>
			<td width="350" bgcolor="#242424" align="center" style="color:white; font-size: 60px;"><?php echo $f129; ?></td>
			<td bgcolor="#121211" align="left" style="color:#e0e0e0; font-size: 60px;">RPM</td>				
		</tr>
</table>

<!-- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF BOILERS ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -->

<?php
$i++;
}
?>