[Date Prev][Date Next][Thread Prev][Thread Next][Interchange by date
][Interchange by thread
]
[ic] Re: trying to get a handle on this user tag thing
C.B. Currier writes:
>> It looks like your query is either returning undef or the empty string,
>> which is why you can't dereference it as an array.
>>
>> Jon
>>
>> On Wed, 2002-10-02 at 10:28, racke@linuxia.de wrote:
>> > C.B. Currier writes:
>> >
>> > > I am trying to get the syntax to get a db handle for querying
>> the current
>> > > db. Below is a sample of the code I have been using but have
>> been getting
>> > > the following error. I have debugged the sql syntax and
>> found it to work
>> > > correctly, not returning a null or 0 record result set. But I
>> believe that
>> > > the result set returned is not compatable with my variable.
>> Any guidance on
>> > > this is much appreciated.
>> > >
>> > > C.B.
>> > >
>> > > Code:
>> > >
>> > > sub {
>> > > my $itmcount = 0;
>> > >
>> > > my $tdb = $db{SKUShipZones};
>> > >
>> > > my $cart = $Carts->{main};
>> > > $itmcount = @$cart;
>> > > foreach (@$cart){
>> > > my $sql = 'Select * from SKUShipZones where
>> sku = \''.$_->{code}.'\';';
>> > > my $qry = $Tag->query({sql => $sql,});
>> > > foreach (@$qry){
>> > > # <<<DO BLA >>>
>> > > }
>> > > }
>> > > return bla;
>> > > }
>> > > EOF
>> > >
>> > > Error:
>> > >
>> > > Runtime error: Can't use string ("") as an ARRAY ref while
>> "strict refs" in
>> > > use at (eval 185) line 11
>> >
>> > I suppose there is something wrong with your query. Check your
>> > database logs.
>> >
>> > This is invalid too: return bla;
>> >
>> > Bye
>> > Racke
>
>
> I ran a debug on the SQL and checked the mysql logs and found no problems
> with the queries generated.
> Even generated the sql and ran them myself and found the resultsets to be
> fully populated.
> Any other thoughts?
Try to add arrayref => 'dummy' to the query parameters.
I think it returns the arrayref. Otherwise use
$Scratch->{dummy} as array reference like that:
for (@{$Scratch->{dummy}}) {
...
}
Ciao
Racke
--
Prolific Interchange Consulting (Excellent German Quality !).
Take a look at Materialboerse (http://www.materialboerse.de/), WITT
(http://www.witt-weiden.de/), Boxmover (http://shop.boxmover.ch/) or
Passionshop (http://www.passionshop.com/racke). Need a shop ? Contact us.