From a98d2bc96cf6c65532c8e1139ef4fc7124021965 Mon Sep 17 00:00:00 2001 From: Erich Eckner Date: Wed, 20 Jul 2022 14:42:14 +0200 Subject: update.php: set timestamp --- html/update.php | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'html') diff --git a/html/update.php b/html/update.php index 39e8d64..7c4d394 100644 --- a/html/update.php +++ b/html/update.php @@ -14,6 +14,7 @@ include "db.php"; $stm = $db -> prepare( 'SELECT' . + ' machines.id as machine_id,' . ' upd_values.id as value_id,' . ' IIF(upd_values.state_id <= "values".state_id, 1, 0) as downgrade,' . ' IIF(upd_values.state_id >= "values".state_id, 1, 0) as upgrade,' . @@ -39,6 +40,12 @@ $updstm = $db -> prepare( ' AND ("values".value != :global_value OR "values".value IS NULL)' ); +$updmstm = $db -> prepare( + 'UPDATE machines' . + ' SET last_update = datetime(' . "'now'" . ')' . + ' WHERE machines.id = :machine' +); + while ($row = $result -> fetchArray()) { if (! array_key_exists($row['state'], $_GET)) continue; @@ -60,8 +67,12 @@ while ($row = $result -> fetchArray()) { $updstm -> bindValue('global_value', $value); $updstm -> bindValue('value_id', $row['value_id']); $updstm -> execute(); + $updmstm -> bindValue('machine', $row['machine_id']); + $updmstm -> execute(); } $stm -> close(); +$updstm -> close(); +$updmstm -> close(); echo 'ok' . "\n"; -- cgit v1.2.3-54-g00ecf