Only populate monitorNames if query is valid

This commit is contained in:
Isaac Connor 2018-01-23 13:28:29 -08:00
parent 933259f9a5
commit 0742217599
1 changed files with 2 additions and 0 deletions

View File

@ -37,11 +37,13 @@ controlOptions[<?php echo $row['Id'] ?>][<?php echo $i ?>] = '<?php echo transla
var monitorNames = new Object();
<?php
$query = empty($_REQUEST['mid']) ? dbQuery('SELECT Name FROM Monitor') : dbQuery('SELECT Name FROM Monitors WHERE Id != ?', array($_REQUEST['mid']) );
if ( $query ) {
while ( $name = dbFetchNext($query, 'Name') ) {
?>
monitorNames['<?php echo validJsStr($name) ?>'] = true;
<?php
} // end foreach
} # end if query
?>
function validateForm( form ) {