[Date Prev][Date Next][Thread Prev][Thread Next][Interchange by date
][Interchange by thread
]
[ic] Query Tag - how do I get a single value?
Hi,
I forgot to mention originally, that I'm trying to do this in a
UserTag, not an embedded [perl] tag.
But the $Sql{..} always fails:
my $dbh = $Sql{products} or return 'Failed to get dbh';
Is $Sql{...} in the documentation somewhere?
On Tuesday 19 Nov 2002 3:20 pm, Mike Heins wrote:
> >
> > $Tag->query("SELECT custom_function('$body')");
> >
> > I would like to get back a single scalar value from this call,
>
> You should use either the standard access method:
> or the DBI you are used to:
>
> [perl tables=products]
> my $dbh = $Sql{products};
> my $sth = $dbh->prepare("SELECT custom_function('$body')")
> or die "Bad query prepare!";
> my ($result) = $sth->selectrow_array();
> return $result;
> [/perl]
--
Mark Gibson <gibsonm@cromwell-tools.co.uk>
Web Developer
Cromwell Group Holdings Ltd