I know somewhere in this code is a stupid mistake, but I just can't find it, so, I'm looking for another pair of eyes. Please help! The error message I'm getting on the following code is:
Transaction aborted because DBD::mysql::st fetchrow_arrayref failed: fetch() without execute() at info.pl line 239.
please look this over and tel me where I blew it. Thank you!
foreach my $col(@Rcols){
push(@AllCols,$col);
}
my $table='foo';
my $fields=join(",",@Rcols);
my($sth);
my $sql = qq{SELECT $fields FROM $table Where workorder_id=?};
$sth = $dbhSt->prepare_cached($sql);
foreach my $rec (sort(keys(%workOrder))){
@workOrders='';
@workOrders=@{$workOrder{$rec}};
@AllKeys=sort(keys(%patient));
@theseIDs=sort grep(/^$rec/,@AllKeys);
foreach my $wo(sort @workOrders){
if($wo eq ''){next;}
else{
$sth->execute($wo);
my %row =();
$sth->bind_columns(map {\$row{$_}} @Rcols);
while (@values=$sth->fetchrow_arrayref){
@values='';
foreach my $col(@Rcols){
my $val= $row{$col};
if($val eq ''){
$val='NULL';
}
push(@values,$val);
}}
@AllValues='';
$k=shift(@theseIDs);
@AllValues=@{$patient{$k}};
push(@AllValues,@values);
$patient{"$k"}=[@AllValues];
}
}
}
$sth->finish;