'; } else if ( isset($_REQUEST['did']) && $_REQUEST['did'] ) { if ( !dbFetchOne('SELECT Id FROM Devices WHERE Id=?', 'Id', array($_REQUEST['did'])) ) { // Deleted in another tab: the UPDATE would match no row and still report a save $error_message .= 'Device not found
'; } else { $saved = (dbQuery('UPDATE Devices SET Name=?, KeyString=? WHERE Id=?', array($name, $keyString, $_REQUEST['did']) ) !== null); } } else { $saved = (dbQuery('INSERT INTO Devices SET Name=?, KeyString=?', array($name, $keyString) ) !== null); } if ( !$saved ) $error_message .= 'Error saving device: '.htmlspecialchars(dbLastError()).'
'; if ( !$error_message ) { $redirect = '?view=devices'; } else { // The modal posts view=device, which has no view file, so show the error on Devices. $view = 'devices'; } } } else { ZM\Error('Unknown action in device'); } // end if action ?>