
[Date Prev][Date Next][Thread Prev][Thread Next][Interchange by date
][Interchange by thread
]
Re: [ic] Call to $Tag->query in perl causing error opening table
patrick.bennett@ccgenesis.com writes:
> This perl code:
>
> [perl tables=awt_section]
> my $crumbTrailIDs = $CGI->{crumb};
> my @crumbs = split ( ",", $crumbTrailIDs );
> my $output = "";
> my $subCrumb = "";
> my $crumbCount = 0;
> foreach $crumb ( @crumbs ) {
> if ( $crumbCount++ > 0 ) { $subCrumb .= ","; }
> $subCrumb .= "$crumb";
> my $sql = "select name from awt_section where section_id = $crumb";
> my $sectionInfo = $Tag->query ( { sql => $sql, } );
> $output .= "<h3>$sql</h3>\n<h4>sub is $subCrumb</h4>\n";
> }
> return ( $output );
> [/perl]
>
> (specifically the call to $Tag->query) produces this error:
>
> [21/October/2001:19:10:04 -0600] awt_dev /cgi-bin/awt_dev/shop_section Safe:
> Can't call method "open_table" on an undefined value at
> /apps/interchange/lib/Vend/Data.pm line 899.
You can call all database access functions in a direct manner,
e.g.:
$set=$Db{awt_section}->query($sql);
$set is a reference to an array of arrays.
Usually you're using sth. like this:
for(@$set) {
$out .= "NAME: $_->[0]<BR>";
}
Ciao
Racke
--
Racke happily hacks Interchange and maintains Debian packages like Courier.
For projects and other business stuff please refer to COBOLT NetServices
(URL: http://www.cobolt.net; Email: info@cobolt.net; Phone: 0041-1-3884400)
_______________________________________________
interchange-users mailing list
interchange-users@interchange.redhat.com
http://interchange.redhat.com/mailman/listinfo/interchange-users