if($config['resolve_emptyonly']==1){$query='select `id`,`ip_addr`,`hostname`,`subnetId` from `ipaddresses` where `hostname` = "" or `hostname` is NULL order by `ip_addr` ASC;';}
else{$query='select `id`,`ip_addr`,`hostname`,`subnetId` from `ipaddresses` order by `ip_addr` ASC;';}
}
# check selected subnets
else{
$query[]="select `id`,`ip_addr`,`hostname`,`subnetId` from `ipaddresses` where ";
$query[]="select `id`,`ip_addr`,`hostname`,`subnetId` from `ipaddresses` where (";