
<?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) {

$f66=mysql_result($result,$i,"juicetankbit");
$f67=mysql_result($result,$i,"juicelvl");
$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 class="tftable24k">
<tr>
<td width="1000%" align="center" colspan="6" border="0"><font color="#00BFFF"><i>TANK LEVELS</i></font></td>
</tr>
</table>
<table class="tftable14k"> 
	<tr>
			<?php
			if ($f66 == 0)
			echo "<td colspan=\"\" width=\"12.5%\" align=\"center\"><font color=\"#e0e0e0\">One Juice Tank</font></td>";
			if ($f66 == 1)
			echo "<td colspan=\"\" width=\"12.5%\" align=\"center\"><font color=\"#e0e0e0\">Two Juice Tanks</font></td>";
			?>
			<td colspan="" width="12.5%" bgcolor="#2E2E2E" align="center"><font color="#e0e0e0" >Syrup RCVR</font></td>
			<td colspan="" width="12.5%" align="center"><font color="#e0e0e0">Syrup Overflow</font></td>
			<td colspan="" width="12.5%" bgcolor="#2E2E2E" align="center"><font color="#e0e0e0">Total Syrup</font></td>
			<td colspan="" width="12.5%" align="center"><font color="#e0e0e0">A RCVR</font></td>
			<td colspan="" width="12.5%" bgcolor="#2E2E2E" align="center"><font color="#e0e0e0">A Overflow</font></td>
			<td colspan="" width="12.5%" align="center"><font color="#e0e0e0">B RCVR</font></td>
			<td colspan="" width="12.5%" bgcolor="#2E2E2E" align="center"><font color="#e0e0e0">B Overflow</font></td>		
	</tr>
	<tr>
			<td width="12.5" align="left"><progress id="progresstanks4k" data-label="<?php echo $f67; ?>%" max="100" value="<?php echo $f67; ?>"></progress></td>
			<td width="12.5" bgcolor="#2E2E2E" align="left"><progress id="progresstanks4k" data-label="<?php echo $f115; ?>%" max="100" value="<?php echo $f115; ?>"></progress></td>
			<td width="12.5" align="left"><progress id="progresstanks4k" data-label="<?php echo $f113; ?>%" max="100" value="<?php echo $f113; ?>"></progress></td>
			<td width="12.5" bgcolor="#2E2E2E" align="left"><progress id="progresstanks4k" data-label="<?php echo round(($f113*.388)+($f115*.612),0); ?>%" max="100" value="<?php echo round(($f113*.388)+($f115*.612),0); ?>"></meter></td>
			<td width="12.5" align="left"><progress id="progresstanks4k" data-label="<?php echo $f116; ?>%" max="100" value="<?php echo $f116; ?>"></progress></td>
			<td width="12.5" bgcolor="#2E2E2E" align="left"><progress id="progresstanks4k" data-label="<?php echo $f117; ?>%" max="100" value="<?php echo $f117; ?>"></progress></td>
			<td width="12.5" align="left"><progress id="progresstanks4k" data-label="<?php echo $f114; ?>%" max="100" value="<?php echo $f114; ?>"></progress></td>
			<td width="12.5" bgcolor="#2E2E2E" align="left"><progress id="progresstanks4k" data-label="<?php echo $f118; ?>%" max="100" value="<?php echo $f118; ?>"></progress></td>
	</tr>
</table>


<?php
$i++;
}
?>