$sqlstatement2 =qq~ SELECT rowid, NamaBarang FROM barangan WHERE CompanyID = '$companyid' ORDER by rowid ASC ~; $sth2 = $dbh->prepare($sqlstatement2); $sth2->execute() or &common_error("SQL Error","Couldn't execute statement2: $DBI::errstr",1); if($sth2->rows() <= 0) { $output .= qq~  No data $companyid in your list, please add. ~; $sth -> finish(); } else { $sth2= $dbh->prepare($sqlstatement2); $sth2->execute() or &common_error("$sqlstatement2","Couldn't execute statement1: $DBI::errstr",1); $number = 0; $harga = 0, $harga2 = kan.$harga; $hargas = 0, $hargas2 = aan.$hargas ; $hargaz = 0, $hargas3 = gan.$hargaz ; while(($id,$ach) = $sth->fetchrow_array()) {