more mysql8 fixes

This commit is contained in:
Isaac Connor 2019-12-08 21:33:29 -05:00
parent 3bd0525e64
commit ea89ebf150
1 changed files with 4 additions and 4 deletions

View File

@ -31,19 +31,19 @@ if ( $action == 'state' ) {
}
} else if ( $action == 'save' ) {
if ( !empty($_REQUEST['runState']) || !empty($_REQUEST['newState']) ) {
$sql = 'SELECT Id,Function,Enabled FROM Monitors ORDER BY Id';
$sql = 'SELECT `Id`,`Function`,`Enabled` FROM Monitors ORDER BY Id';
$definitions = array();
foreach( dbFetchAll($sql) as $monitor ) {
foreach ( dbFetchAll($sql) as $monitor ) {
$definitions[] = $monitor['Id'].':'.$monitor['Function'].':'.$monitor['Enabled'];
}
$definition = join(',', $definitions);
if ( $_REQUEST['newState'] )
$_REQUEST['runState'] = $_REQUEST['newState'];
dbQuery('REPLACE INTO States SET Name=?, Definition=?', array($_REQUEST['runState'],$definition));
dbQuery('REPLACE INTO `States` SET `Name`=?, `Definition`=?', array($_REQUEST['runState'],$definition));
}
} else if ( $action == 'delete' ) {
if ( isset($_REQUEST['runState']) )
dbQuery('DELETE FROM States WHERE Name=?', array($_REQUEST['runState']));
dbQuery('DELETE FROM `States` WHERE `Name`=?', array($_REQUEST['runState']));
}
$view = 'console';
?>