Update view_log.php

This commit is contained in:
jakani24
2024-04-27 12:59:15 +02:00
parent 61478255b8
commit 9d5dc3aa4f

View File

@@ -198,7 +198,7 @@ $conn->close();
$total_pages = ceil($total_entries / $page_size); $total_pages = ceil($total_entries / $page_size);
// Query log entries for the current page with filters // Query log entries for the current page with filters
$sql = "SELECT * FROM log,machines WHERE loglevel LIKE ? AND logtext LIKE ? AND machine_id LIKE ? AND time LIKE ? AND machine_name=machine_id ORDER BY log.id DESC LIMIT ?, ?"; $sql = "SELECT * FROM machines,log WHERE loglevel LIKE ? AND logtext LIKE ? AND machine_id LIKE ? AND time LIKE ? AND machine_name=machine_id ORDER BY log.id DESC LIMIT ?, ?";
$stmt = $conn->prepare($sql); $stmt = $conn->prepare($sql);
$loglevel = "%" . $loglevel . "%"; $loglevel = "%" . $loglevel . "%";
$logtext = "%" . $logtext . "%"; $logtext = "%" . $logtext . "%";
@@ -215,7 +215,7 @@ $conn->close();
echo '<table class="table" style="overflow-x:auto">'; echo '<table class="table" style="overflow-x:auto">';
echo '<thead>'; echo '<thead>';
echo '<tr>'; echo '<tr>';
echo '<th>Entry id</th><th>Loglevel</th><th>Logtext</th><th>Machine id</th><th>Time & date</th><th>Location</th><th>Delete entry</th>'; echo '<th>Entry id</th><th>Loglevel</th><th>Logtext</th><th>Machine id</th><th>Location</th><th>Time & date</th><th>Delete entry</th>';
echo '</tr>'; echo '</tr>';
echo '</thead>'; echo '</thead>';
echo '<tbody>'; echo '<tbody>';
@@ -228,7 +228,7 @@ $conn->close();
echo '<td><input type="text" class="form-control" name="loglevel" placeholder="' . str_replace("%","",$loglevel) . '"></td>'; echo '<td><input type="text" class="form-control" name="loglevel" placeholder="' . str_replace("%","",$loglevel) . '"></td>';
echo '<td><input type="text" class="form-control" name="logtext" placeholder="' . str_replace("%","",$logtext) . '"></td>'; echo '<td><input type="text" class="form-control" name="logtext" placeholder="' . str_replace("%","",$logtext) . '"></td>';
echo '<td><input type="text" class="form-control" name="machine_id" placeholder="' . str_replace("%","",$machine_id) . '"></td>'; echo '<td><input type="text" class="form-control" name="machine_id" placeholder="' . str_replace("%","",$machine_id) . '"></td>';
echo '<td><input type="text" class="form-control" name="time" placeholder="' . str_replace("%","",$machine_location) . '"></td>'; echo '<td><input type="text" class="form-control" name="machine_location" placeholder="' . str_replace("%","",$machine_location) . '"></td>';
echo '<td><input type="text" class="form-control" name="time" placeholder="' . str_replace("%","",$time) . '"></td>'; echo '<td><input type="text" class="form-control" name="time" placeholder="' . str_replace("%","",$time) . '"></td>';
echo '<td><button type="button" class="btn btn-danger" data-bs-toggle="modal" data-bs-target="#delete_all">Delete log</button></td>'; echo '<td><button type="button" class="btn btn-danger" data-bs-toggle="modal" data-bs-target="#delete_all">Delete log</button></td>';
echo '</form>'; echo '</form>';