[ic] Need help with a perl query

IC ic at tvcables.co.uk
Tue May 26 00:14:50 UTC 2009


Hi folks,

I am trying to use a piece of perl to return a list of order numbers (with
status processing) and skus ordered, I have pasted the code below, it
returns the list of order numbers ok from transactions but it doesn't return
any skus from the orderline table. I also tried replacing my $lookup
variable with a fixed orderline eg "12345-1" but it still didn't work.


[perl orderline transactions]
   my $db = $Db{transactions};
   my $db2 = $Db{orderline};
   my $ary = $db->query('select order_number from
 transactions where status = "processing"');
 

  my $out = '';
     foreach $row ( @$ary) {
     my ($order_number) = @$row;
     my $lookup = "%" . $order_number . "%";
 
     my $ary2 = $db2->query('select sku from
     orderline where code like $lookup');
 
     foreach $row ( @$ary2) {
     my ($sku) .= @$row;
     }
 
         $out .= "$order_number : $sku<br>\n";
 }
 return $out;
[/perl]





More information about the interchange-users mailing list