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

141 lines
3.5 KiB
PHP

<head>
<link rel="stylesheet" href="styles.css">
<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.14',$username,$password);
@mysql_select_db($database) or die( "Unable to select database");
$term = mysql_real_escape_string($_REQUEST['term']);
$query = "(SELECT * FROM tables WHERE Z_TIMESTAMP LIKE '%".$term."%' ORDER BY id DESC)";
$result=mysql_query($query);
mysql_close();
?>
<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>neoutput</th>
<th>nesetpoint</th>
<th>nescale</th>
<th>seoutput</th>
<th>sescale</th>
<th>sesetpoint</th>
<th>woutput</th>
<th>wscale</th>
<th>wsetpoint</th>
<th>tdoutput</th>
<th>tdalarm</th>
<th>nam</th>
<th>sam</th>
<th>wam</th>
<th>tdratio</th>
<th>tdsetpoint</th>
<th>tdinput</th>
<th>tdmg</th>
<th>nesetpoint3</th>
<th>nespswitch</th>
<th>wsetpoint3</th>
<th>wspswitch</th>
<th>mcctons</th>
<th>tdratios</th>
</tr>
</thead>
<tbody>
<?php
while($row=mysql_fetch_assoc($result))
{
echo "<tr>";
echo "<td>".$row [ 'neoutput' ]."</td>";
echo "<td>".$row [ 'nesetpoint' ]."</td>";
echo "<td>".$row [ 'nescale' ]."</td>";
echo "<td>".$row [ 'seoutput' ]."</td>";
echo "<td>".$row [ 'sescale' ]."</td>";
echo "<td>".$row [ 'sesetpoint' ]."</td>";
echo "<td>".$row [ 'woutput' ]."</td>";
echo "<td>".$row [ 'wscale' ]."</td>";
echo "<td>".$row [ 'wsetpoint' ]."</td>";
echo "<td>".$row [ 'tdoutput' ]."</td>";
echo "<td>".$row [ 'tdalarm' ]."</td>";
echo "<td>".$row [ 'nam' ]."</td>";
echo "<td>".$row [ 'sam' ]."</td>";
echo "<td>".$row [ 'wam' ]."</td>";
echo "<td>".$row [ 'tdratio' ]."</td>";
echo "<td>".$row [ 'tdsetpoint' ]."</td>";
echo "<td>".$row [ 'tdinput' ]."</td>";
echo "<td>".$row [ 'tdmg' ]."</td>";
echo "<td>".$row [ 'nesetpoint3' ]."</td>";
echo "<td>".$row [ 'nespswitch' ]."</td>";
echo "<td>".$row [ 'wsetpoint3' ]."</td>";
echo "<td>".$row [ 'wspswitch' ]."</td>";
echo "<td>".$row [ 'mcctons' ]."</td>";
echo "<td>".$row [ 'tdratios' ]."</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>
</body>
</html>