Files
controls-web/OLD/results.php
2026-02-17 12:44:37 -06:00

167 lines
4.2 KiB
PHP

<!DOCTYPE html>
<html>
<head>
<link href="style.css" rel="stylesheet" type="text/css" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<script src="http://code.jquery.com/jquery-1.11.0.min.js"></script>
<script src="http://code.jquery.com/jquery-migrate-1.2.1.min.js"></script>
</head>
<body>
<?php
$username="corey";
$password="41945549";
$database="controls";
mysql_connect('192.168.0.13',$username,$password);
@mysql_select_db($database) or die( "Unable to select database");
$term = mysql_real_escape_string($_REQUEST['term']);
$query = "(SELECT * FROM milling WHERE Z_TIMESTAMP LIKE '%".$term."%' ORDER BY id DESC)";
$result=mysql_query($query);
mysql_close();
?>
<div class="center">
<div class="header">
<h1>LASUCA CONTROLS</h1>
<p>Search Results</p>
</div>
<div class="row">
<div class="col-12">
<table style="margin: 0px auto;" class="stat">
<tr>
<th><a href="search.php">RESET SEARCH</a></th>
</tr>
<tr>
<th>Search Results</th>
</tr>
<tr>
<th><a href="edit" id="edit">Toggle Columns On/Off</a></th>
</tr>
<table id="table" style="margin: 0px auto;" class="stat">
<thead>
<tr>
<th>Timestamp</th>
<th>Prev Tons</th>
<th>Prev Run</th>
<th>MCC Spd</th>
<th>K1 Spd</th>
<th>K2 Spd</th>
<th>K3 Spd</th>
<th>M1 Spd</th>
<th>M2 Spd</th>
<th>M3 Spd</th>
<th>M4 Spd</th>
<th>M5 Spd</th>
<th>M6 Spd</th>
<th>M1 Lvl</th>
<th>M2 Lvl</th>
<th>M3 Lvl</th>
<th>M4 Lvl</th>
<th>M5 Lvl</th>
<th>M6 Lvl</th>
</tr>
</thead>
<tbody>
<?php
while($row=mysql_fetch_assoc($result))
{
echo "<tr>";
echo "<td>".$row [ 'Z_TIMESTAMP' ]."</td>";
echo "<td>".$row [ 'PREVTONS' ]."</td>";
echo "<td>".$row [ 'PREVTIME' ]."</td>";
echo "<td>".$row [ 'MAINSPD' ]."</td>";
echo "<td>".$row [ 'KNIFE1SPD' ]."</td>";
echo "<td>".$row [ 'KNIFE2SPD' ]."</td>";
echo "<td>".$row [ 'KNIFE3SPD' ]."</td>";
echo "<td>".$row [ 'MILL1SPD' ]."</td>";
echo "<td>".$row [ 'MILL2SPD' ]."</td>";
echo "<td>".$row [ 'MILL3SPD' ]."</td>";
echo "<td>".$row [ 'MILL4SPD' ]."</td>";
echo "<td>".$row [ 'MILL5SPD' ]."</td>";
echo "<td>".$row [ 'MILL6SPD' ]."</td>";
echo "<td>".$row [ 'MILL1LVL' ]."</td>";
echo "<td>".$row [ 'MILL2LVL' ]."</td>";
echo "<td>".$row [ 'MILL3LVL' ]."</td>";
echo "<td>".$row [ 'MILL4LVL' ]."</td>";
echo "<td>".$row [ 'MILL5LVL' ]."</td>";
echo "<td>".$row [ 'MILL6LVL' ]."</td>";
echo "</tr>";
}
?>
</tbody>
</table>
</table>
<script type="text/javascript">
$('#edit').click(function() {
var headers = $('#table th').map(function() {
var th = $(this);
return {
text: th.text(),
shown: th.css('display') != 'none'
};
});
var h = ['<div id=tableEditor><button id=done>Done</button><table><thead>'];
$.each(headers, function() {
h.push('<tr><th><input type=checkbox',
(this.shown ? ' checked ' : ' '),
'/> ',
this.text,
'</th></tr>');
});
h.push('</thead></table></div>');
$('body').append(h.join(''));
$('#done').click(function() {
var showHeaders = $('#tableEditor input').map(function() { return this.checked; });
$.each(showHeaders, function(i, show) {
var cssIndex = i + 1;
var tags = $('#table th:nth-child(' + cssIndex + '), #table td:nth-child(' + cssIndex + ')');
if (show)
tags.show();
else
tags.hide();
});
$('#tableEditor').remove();
return false;
});
return false;
});
</script>
</div>
</div>
<?php include 'footer.php';?>
<script type="text/javascript">
// create the back to top button
$('body').prepend('<a href="#" class="back-to-top">Back to Top</a>');
var amountScrolled = 300;
$(window).scroll(function() {
if ($(window).scrollTop() > amountScrolled) {
$('a.back-to-top').fadeIn('slow');
} else {
$('a.back-to-top').fadeOut('slow');
}
});
$('a.back-to-top, a.simple-back-to-top').click(function() {
$('body').animate({
scrollTop: 0
}, 'fast');
return false;
});
</script>
</body>
</html>