-while(my @row = $statement_handle->fetchrow_array()) {
- # Assign some nice to read variable names for the DB fields.
- my $connection_name = $row[0];
- my $connection_open_time = $row[1];
- my $connection_close_time = $row[2];
- my $connection_bytes_recieved = &General::formatBytes($row[3]);
- my $connection_bytes_sent = &General::formatBytes($row[4]);
-
- # Colorize columns.
- if ($lines % 2) {
- $col="bgcolor='$color{'color20'}'";
- } else {
- $col="bgcolor='$color{'color22'}'";
- }
+# Only try to fetch the DB items if there is no error message.
+unless ($errormessage) {
+ while(my @row = $statement_handle->fetchrow_array()) {
+ # Assign some nice to read variable names for the DB fields.
+ my $connection_name = $row[0];
+ my $connection_open_time = $row[1];
+ my $connection_close_time = $row[2];
+ my $connection_bytes_recieved = &General::formatBytes($row[3]);
+ my $connection_bytes_sent = &General::formatBytes($row[4]);
+
+ # Colorize columns.
+ if ($lines % 2) {
+ $col="bgcolor='$color{'color20'}'";
+ } else {
+ $col="bgcolor='$color{'color22'}'";
+ }