$query = "SELECT ID,NEID,VPI,VCI,PCR,PVC,IP FROM NB WHERE NB.NEID='$neid' ORDER BY RC_CISCO_NB.ID DESC LIMIT 1 "; $sth = $dbh->prepare($query) or die "Error in query prepare: $DBI::errstr\n"; $sth->execute or die "Error executing query: $DBI::errstr\n";