Even when the query is empty the If clause in the while loop will not print "name NOT defined"<br><br>I suspect this has something to do with fetchrow_array and using !defined() doesn't work.<br><br>==========================================================
<br><br>my $query = "select deviceip, devicename from (select * from admDevice where admDevice.devicename like \'%$_%\') as devi<br> ces, admSyslogSrc where devices.deviceId = admSyslogSrc.deviceId";<br>
<br>$sth = $dbh->prepare($query);<br><br>if( defined( $sth )) {<br> $sth->execute( );<br>}<br><br>while ( my ($hostint, $name) = $sth->fetchrow_array ) {<br> if ( !defined($name) ) {<br> print "name NOT defined";
<br> } <br>