[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
Hi there,
I've been trying everything for over a week so any help is much appreciated.
I'm trying the example in the mail archive suggestion of nestable [query]
by Mark Johnson, Jeff Carnahan, and Mike Heins.
Background:
I have a product_cat table with model_id and model name columns which
I'm trying to retrieve inside [perl][/perl] tags. I don't want to do it
inside [query][/query]
or [loop][/loop] because I already a [query][/query] in my page and I do a
[more-list][more][/more-list]
to print out the page numbers and get my content dynamically (ie. 8 items
per page).
What I'm trying to do is to fill up a data array inside this [perl] DB call
to be used later
but can't seem to get $db->query() to work.
My example is:
<html>
Going into perl.<br>
[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 = "model id: $model_id -- model_name: $model_name\n";
}
return "$retstr";
[/perl]
After the end of perl.
</html>
But I keep getting this message on the error.log file
192.168.0.30 rDrocwAK:192.168.0.30 - [23/February/2001:09:58:17 -0800]
mystore /cgi-bin/mystore/
test.html Safe: Can't call method "query" on an undefined value at (eval
317) line 4.
>
>
> 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 = "model id: $model_id -- model_name: $model_name\n";
> }
>
> return "$retstr";
>
>
>
I'm running Interchange 4.6.3 on RedHat 6.2 and MySql 3.2.2.25. Any idea
what I'm not
doing right? Did I forget to configure something? Suggestions? Comments?
Ideas? Hints?
Thanks.
Annie Flippo
aflippo@lunamedium.com
_______________________________________________
Interchange-users mailing list
Interchange-users@lists.akopia.com
http://lists.akopia.com/mailman/listinfo/interchange-users