<?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 milling ORDER BY id DESC LIMIT 1)"; 
$result=mysql_query($query);

$num=mysql_numrows($result);

mysql_close();
?>

<?php
$i=0;
while ($i < $num) {

$f4=mysql_result($result,$i,"tonshr");
$f7=mysql_result($result,$i,"mill1wsp");
$f9=mysql_result($result,$i,"15minavg");
$f10=mysql_result($result,$i,"weightwsp");
$f11=mysql_result($result,$i,"Levelswitch");
$f21=mysql_result($result,$i,"mill1lvl");
$f22=mysql_result($result,$i,"mill2lvl");
$f23=mysql_result($result,$i,"mill3lvl");
$f24=mysql_result($result,$i,"mill4lvl");
$f25=mysql_result($result,$i,"mill5lvl");
$f26=mysql_result($result,$i,"mill6lvl");
$f38=mysql_result($result,$i,"mill1spd");
$f33=mysql_result($result,$i,"mill2spd");
$f34=mysql_result($result,$i,"mill3spd");
$f35=mysql_result($result,$i,"mill4spd");
$f36=mysql_result($result,$i,"mill5spd");
$f37=mysql_result($result,$i,"mill6spd");
$f15=mysql_result($result,$i,"netablwt");
$f2=mysql_result($result,$i,"mainspd");
$f5=mysql_result($result,$i,"mccoutput");
$f57=mysql_result($result,$i,"imb5flow");
$f58=mysql_result($result,$i,"imb5sp");
$f75=mysql_result($result,$i,"imbflow");
$f76=mysql_result($result,$i,"imbsp");
$f79=mysql_result($result,$i,"mill1output");
$f80=mysql_result($result,$i,"mill1automan1");
$f110=mysql_result($result,$i,"dmbeltrunning");
$f111=mysql_result($result,$i,"tdbeltscale");
$f112=mysql_result($result,$i,"tdbeltscaleonoff");
$f113=mysql_result($result,$i,"syrupoverflow");
$f114=mysql_result($result,$i,"molbreclvl");
$f115=mysql_result($result,$i,"syruprcvrlvl");
$f116=mysql_result($result,$i,"amollvl");
$f117=mysql_result($result,$i,"amoloverflow");
$f118=mysql_result($result,$i,"bmoloverflow");
?>
<table width="100%">
	<tr>
	<td width="50%">
	<table class="tftable2">
		<tr>
		<td width="50%" align="center" colspan="5" border="0"><font color="#00BFFF"><i>EAST MILL TANDEM</i></font></td>
		</tr>
	</table>
	
	<table class="tftableEAST"> 
		<tr height="30">
			<td bgcolor="#0B3B17" align="center"><font color="#e0e0e0">1</font></td>
			<td bgcolor="#0B3B17" align="center"><font color="#e0e0e0">Level</font></td>
			<td width="76" bgcolor="#0B3B17" align="center"><font color="#00FF00"><?php echo $f21; ?>%</font></td>
			<td width="130" bgcolor="#0B3B17" align="left"><progress id="progressmills" data-label="<?php echo $f21; ?>%" max="100" value="<?php echo $f21; ?>"></progress></td>
			<td width="70" bgcolor="#0B3B17" align="center"><font color="#e0e0e0">RPM</font></td>
			<td width="70" bgcolor="#0B3B17" align="left"><font color="#00FF00"><?php echo $f38; ?></font></td>
			<td align="left" colspan="2"><font color="#e0e0e0">MCC FPM</font></td>
			<td width="50" align="right"><font color="#00FF00"><?php echo $f2; ?></font></td>
			<td align="left"><font color="#e0e0e0">FPM</font></td>
			
		</tr>
		<tr>
			<td bgcolor="#D7DF01" align="center"><font color="#000000">2</font></td>
			<td bgcolor="#D7DF01" align="center"><font color="#000000">Level</font></td>
			<td bgcolor="#D7DF01" align="center"><font color="#000000"><?php echo $f22; ?>%</font></td>		
			<td bgcolor="#D7DF01" align="left"><progress id="progressmills" data-label="<?php echo $f22; ?>%" max="100" value="<?php echo $f22; ?>"></progress></td>
			<td bgcolor="#D7DF01" align="center"><font color="#000000">RPM</font></td>
			<td bgcolor="#D7DF01" align="left"><font color="#000000"><?php echo $f33; ?></font></td>
			<td align="left" colspan="2"><font color="#e0e0e0">MCC Output</font></td>
			<td align="right"><font color="#00FF00"><?php echo $f5; ?></font></td>
			<td align="left"><font color="#e0e0e0">%</font></td>				
		</tr>
		<tr>			
			<td bgcolor="#04B404" align="center"><font color="#e0e0e0">3</font></td>
			<td bgcolor="#04B404" align="center"><font color="#e0e0e0">Level</font></td>
			<td bgcolor="#04B404" align="center"><font color="#00FF00"><?php echo $f23; ?>%</font></td>	
			<td bgcolor="#04B404" align="left"><progress id="progressmills" data-label="<?php echo $f23; ?>%" max="100" value="<?php echo $f23; ?>"></progress></td>
			<td bgcolor="#04B404" align="center"><font color="#e0e0e0">RPM</font></td>
			<td bgcolor="#04B404" align="left"><font color="#00FF00"><?php echo $f34; ?></font></td>
			<td align="left" colspan="2"><font color="#e0e0e0">MCC Tons</font></td>
			<td align="right"><font color="#00FF00"><?php echo $f15; ?></font></td>
			<td align="left"><font color="#e0e0e0">Tons</font></td>			
		</tr>
		<tr>			
			<td bgcolor="#DF7401" align="center"><font color="#e0e0e0">4</font></td>
			<td bgcolor="#DF7401" align="center"><font color="#e0e0e0">Level</font></td>
			<td bgcolor="#DF7401" align="center"><font color="#00FF00"><?php echo $f24; ?>%</font></td>		
			<td bgcolor="#DF7401" align="left"><progress id="progressmills" data-label="<?php echo $f24; ?>%" max="100" value="<?php echo $f24; ?>"></progress></td>
			<td bgcolor="#DF7401" align="center"><font color="#e0e0e0">RPM</font></td>
			<td bgcolor="#DF7401" align="left"><font color="#00FF00"><?php echo $f35; ?></font></td>
			<td align="left"><font color="#e0e0e0">Mill 1 SP</font></td><?php
		if ($f80 == 1)
			echo "<td colspan=\"1\" align=\"center\" bgcolor=\"#0B3B17\"><font color=\"#e0e0e0\">A</font></td>";
		if ($f80 == 0)
			echo "<td colspan=\"1\" align=\"center\" bgcolor=\"#8A0808\"><font color=\"#e0e0e0\">M</font></td>";
		?>
		<?php
		if ($f11 == 1)
			echo "<td align=\"right\"><font color=\"00FF00\"><b> $f10 </b></font></td>";
		if ($f11 == 0)
			echo "<td align=\"right\"><font color=\"00FF00\"><b> $f7 </b></font></td>";
		?>
		<?php
		if ($f11 == 1)
			echo "<td><font color=\"#e0e0e0\">Tons/Hr</font></td>";
		if ($f11 == 0)
			echo "<td><font color=\"#e0e0e0\">%</font></td>";
		?>
		</tr>
		<tr>			
			<td bgcolor="#5858FA" align="center"><font color="#e0e0e0">5</font></td>
			<td bgcolor="#5858FA" align="center"><font color="#e0e0e0">Level</font></td>		
			<td bgcolor="#5858FA" align="center"><font color="#00FF00"><?php echo $f25; ?>%</font></td>	
			<td bgcolor="#5858FA" align="left"><progress id="progressmills" data-label="<?php echo $f25; ?>%" max="100" value="<?php echo $f25; ?>"></progress></td>
			<td bgcolor="#5858FA" align="center"><font color="#e0e0e0">RPM</font></td>			
			<td bgcolor="#5858FA" align="left"><font color="#00FF00"><?php echo $f36; ?></font></td>
			<td align="left" colspan="2"><font color="#e0e0e0">Tons Per Hour</font></td>
			<td align="right"><font color="#00FF00"><?php echo $f4; ?></font></td>
			<td align="left"><font color="#e0e0e0">TPH</font></td>					
		</tr>
		<tr>			
			<td bgcolor="#8A0808" align="center"><font color="#e0e0e0">6</font></td>
			<td bgcolor="#8A0808" align="center"><font color="#e0e0e0">Level</font></td>
			<td bgcolor="#8A0808" align="center"><font color="#00FF00"><?php echo $f26; ?>%</font></td>				
			<td bgcolor="#8A0808" align="left"><progress id="progressmills" data-label="<?php echo $f26; ?>%" max="100" value="<?php echo $f26; ?>"></progress></td>
			<td bgcolor="#8A0808" align="center"><font color="#e0e0e0">RPM</font></td>	
			<td bgcolor="#8A0808" align="left"><font color="#00FF00"><?php echo $f37; ?></font></td>
			<td align="left" colspan="2"><font color="#e0e0e0">Avg Tons Per Hour</font></td>
			<td align="right"><font color="#00FF00"><?php echo $f9; ?></font></td>
			<td align="left"><font color="#e0e0e0">TPH</font></td>					
			
		</tr>
		<tr>
			<td bgcolor="#2E2E2E" colspan="4"><font color="#e0e0e0">East Imibition 6 Flow:</font></td>
			<td bgcolor="#2E2E2E" align="right" id="lsp"><font color="00FF00"><b><?php echo $f75; ?></b></font></td>
			<td bgcolor="#2E2E2E"><font color="#e0e0e0">GPM</font></td>

			<td colspan="2"><font color="#e0e0e0">East Imibition 6 SP:</font></td>
			<td align="right" id="lsp"><font color="00FF00"><b><?php echo $f76; ?></b></font></td>
			<td><font color="#e0e0e0">GPM</font></td>
		</tr>
		<tr>
			<td bgcolor="#2E2E2E" colspan="4"><font color="#e0e0e0">East Imibition 5 Flow:</font></td>
			<td bgcolor="#2E2E2E" align="right" id="lsp"><font color="00FF00"><b><?php echo $f57; ?></b></font></td>
			<td bgcolor="#2E2E2E"><font color="#e0e0e0">GPM</font></td>

			<td colspan="2"><font color="#e0e0e0">East Imibition 5 SP:</font></td>
			<td align="right" id="lsp"><font color="00FF00"><b><?php echo $f58; ?></b></font></td>
			<td><font color="#e0e0e0">GPM</font></td>
		</tr>
	</table>
	</td>

	<td width="50%">
	<table class="tftable2">
		<tr>
		<td width="50%" align="center" colspan="6" border="0"><font color="#00BFFF"><i>WEST MILL TANDEM</i></font></td>
		</tr>
	</table>
	<table class="tftableWEST"> 
		<tr>
			<td bgcolor="#0B3B17" align="center"><font color="#e0e0e0">1</font></td>
			<td bgcolor="#0B3B17" align="center"><font color="#e0e0e0">Level</font></td>
			<td width="76" bgcolor="#0B3B17" align="center"><font color="#00FF00"></font></td>
			<td width="130" bgcolor="#0B3B17" align="left"><progress id="progressmills" max="100" value=""></progress></td>
			<td width="80" bgcolor="#0B3B17" align="center"><font color="#e0e0e0">RPM</font></td>
			<td width="70" bgcolor="#0B3B17" align="left"><font color="#00FF00"></font></td>
			<td align="left"><font color="#e0e0e0">MCC FPM</font></td>
			<td width="50" align="right"><font color="#00FF00"></font></td>
			<td align="left"><font color="#e0e0e0">FPM</font></td>		
		</tr>
		<tr>
			<td bgcolor="#D7DF01" align="center"><font color="#000000">2</font></td>
			<td bgcolor="#D7DF01" align="center"><font color="#000000">Level</font></td>
			<td bgcolor="#D7DF01" align="center"><font color="#000000"></font></td>		
			<td bgcolor="#D7DF01" align="left"><progress id="progressmills" max="100" value=""></progress></td>
			<td bgcolor="#D7DF01" align="center"><font color="#000000">RPM</font></td>
			<td bgcolor="#D7DF01" align="left"><font color="#000000"></font></td>
			<td align="left"><font color="#e0e0e0">MCC Output</font></td>
			<td align="right"><font color="#00FF00"></font></td>
			<td align="left"><font color="#e0e0e0">%</font></td>				
		</tr>
		<tr>			
			<td bgcolor="#04B404" align="center"><font color="#e0e0e0">3</font></td>
			<td bgcolor="#04B404" align="center"><font color="#e0e0e0">Level</font></td>
			<td bgcolor="#04B404" align="center"><font color="#00FF00"></font></td>	
			<td bgcolor="#04B404" align="left"><progress id="progressmills" max="100" value=""></progress></td>
			<td bgcolor="#04B404" align="center"><font color="#e0e0e0">RPM</font></td>
			<td bgcolor="#04B404" align="left"><font color="#00FF00"></font></td>
			<td align="left"><font color="#e0e0e0">MCC Tons</font></td>
			<td align="right"><font color="#00FF00"></font></td>
			<td align="left"><font color="#e0e0e0">Tons</font></td>			
		</tr>
		<tr>			
			<td bgcolor="#DF7401" align="center"><font color="#e0e0e0">4</font></td>
			<td bgcolor="#DF7401" align="center"><font color="#e0e0e0">Level</font></td>
			<td bgcolor="#DF7401" align="center"><font color="#00FF00"></font></td>		
			<td bgcolor="#DF7401" align="left"><progress id="progressmills" max="100" value=""></progress></td>
			<td bgcolor="#DF7401" align="center"><font color="#e0e0e0">RPM</font></td>
			<td bgcolor="#DF7401" align="left"><font color="#00FF00"></font></td>	
			<td align="left"><font color="#e0e0e0">Mill 1 SP</font></td>
			<td align="right"><font color="#00FF00"></font></td>
			<td align="left"><font color="#e0e0e0">%</font></td>			
		</tr>
		<tr>			
			<td bgcolor="#5858FA" align="center"><font color="#e0e0e0">5</font></td>
			<td bgcolor="#5858FA" align="center"><font color="#e0e0e0">Level</font></td>			
			<td bgcolor="#5858FA" align="center"><font color="#00FF00"></font></td>	
			<td bgcolor="#5858FA" align="left"><progress id="progressmills" max="100" value=""></progress></td>
			<td bgcolor="#5858FA" align="center"><font color="#e0e0e0">RPM</font></td>			
			<td bgcolor="#5858FA" align="left"><font color="#00FF00"></font></td>	
			<td align="left"><font color="#e0e0e0">Tons Per Hour</font></td>
			<td align="right"><font color="#00FF00"></font></td>
			<td align="left"><font color="#e0e0e0">TPH</font></td>			
		</tr>
		<tr>			
			<td bgcolor="#8A0808" colspan="6" align="center"><font color="#e0e0e0"></font></td>	
			<td align="left"><font color="#e0e0e0">Avg Tons Per Hour</font></td>
			<td align="right"><font color="#00FF00"></font></td>
			<td align="left"><font color="#e0e0e0">TPH</font></td>				
		</tr>
		<tr>
			<td bgcolor="#2E2E2E" colspan="4"><font color="#e0e0e0">West Imibition 5 Flow:</font></td>
			<td bgcolor="#2E2E2E" align="right" id="lsp"><font color="00FF00"><b></b></font></td>
			<td bgcolor="#2E2E2E"><font color="#e0e0e0">GPM</font></td>

			<td colspan="1"><font color="#e0e0e0">West Imibition 5 SP:</font></td>
			<td align="right" id="lsp"><font color="00FF00"><b></b></font></td>
			<td><font color="#e0e0e0">GPM</font></td>
		</tr>
		<tr>
			<td colspan="9"><font color="#e0e0e0"></font></td>
		</tr>
	</table>
	</td>
</tr>
</table>
<?php
$i++;
}
?>