[Date Prev][Date Next][Thread Prev][Thread Next][Interchange by date
][Interchange by thread
]
RE: [ic] Filling perl hashes with [query] and searching the hash for product display restriction
At 04:46 PM 2/22/2001 -0800, Annie Flippo wrote:
>I'm running this example but my version is
>[perl tables=product_cat interpolate=1] my $db = $Db{product_cat}; @set =
>$db->query("SELECT model_id, model_name FROM product_cat order by
>model_name"); $retstr = ""; foreach $row (@$set) ($model_id, $model_name)
>= @$row; $retstr = $retstr . "model id: $model_id -- model_name: $model_name
>\n"; } return "$retstr"; [/perl]
>But I get this error message in my error.log file.
>192.168.0.30 6ssmWYaM:192.168.0.30 - [22/February/2001:16:22:44 -0800]
>mystore/cgi-bin/mystore/test.html Safe: Can't call method "query" on an
>undefined value at (eval 317) line 6.
>My store is set up on Redhat 6.2 with MySQL 3.2.2.25. Any idea what I'm not
>doing right?
>Did I forget to configure something? Any suggestions are appreciated.
>Thanks.
>
>Annie Flippo
>aflippo@lunamedium.com
Sorry, I'd like to help you, but I couldn't read your post. Could you
re-format it and re-send (MIME attach if you have to). Try sending it to
yourself to see if it's readable.
Additionally, did you see Mike Heins recent post about how [query] is
actually nestable (prefix="inner", outer-, etc.).
-Dan
> >-----Original Message----- >Sent: Thursday, January 25, 2001 12:51 PM >
> >Here is how I'm trying to do it in Perl (please don't laugh). > > [perl
>tables=coverage] > my $db = $Db{coverage}; > @set = $db->query('select
>hcpcs,copay from coverage WHERE >carrier_idr = 11001'); >
>$Scratch->{covered_hcpcs} = \@set; > > $db = $Db{products}; > #loop through
>all of $Scratch->{covered_hcpcs} >here somehow, setting $i to hcpcs value. >
>@set = $db->query('select sku from >products WHERE hcpcs =
>$Scratch->{covered_hcpcs->{$i}}'); > #end loop. > $Scratch->{covered_skus} =
>\@set; > return; > [/perl] > Not to bad... Here's some more: [perl
>tables=coverage interpolate=1] my $db = $Db{coverage}; $set =
>$db->query("SELECT hcpcs, copay FROM coverage WHERE carrier_idr = '[scratch
>cust_carrier_idr]"); $Scratch->{covered_hcpcs} = $set;
>$Scratch->{covered_products} = []; $db = $Db{products}; foreach $row (@$set)
>{ ($hcpcs, $copay) = @$row; $prod_set = $db->query("SELECT sku FROM products
>WHERE hcpcs = '$hcpcs'"); foreach $prod_row (@$prod_set) { ($sku) =
>@$prod_row; push(@{ $Scratch->{covered_products} }, $sku); } } #
>$Scratch->{covered_products} should now be an array # of product sku's that
>are covered. return; [/perl] -- Jeff Carnahan - jcarnahan@networq.com
>
>
>
>
>
>
>
>
>
>
>
>
>_______________________________________________
>Interchange-users mailing list
>Interchange-users@lists.akopia.com
>http://lists.akopia.com/mailman/listinfo/interchange-users
Dan Browning, Cyclone Computer Systems, danb@cyclonecomputers.com
_______________________________________________
Interchange-users mailing list
Interchange-users@lists.akopia.com
http://lists.akopia.com/mailman/listinfo/interchange-users