in reply to Re: Re: Array of Arrays & Fetchrow
in thread Array of Arrays & Fetchrow

I may have spoke to soon. I used robartes code:

push @rows, $_ for $ratings->fetchrow_arrayref(); print XML "$rows[0]->[0]:$rows[0]->[1]:$rows[1]->[0]:$rows[1]->[1]\n";
And my output is 1111:1::

So I added a: push @rows, $_ for $ratings->fetchrow_arrayref(); This is to get the second line from the DB.

And my output is 2222:2:2222:2 instead of 1111:1:2222:2 like I thought it would be. Can anybody tell me what I'm doing wrong here?
Thanks

BW

Replies are listed 'Best First'.
Re: Re: Re: Re: Array of Arrays & Fetchrow
by robartes (Priest) on Nov 01, 2002 at 18:08 UTC
    Hi, something's fishy indeed - probably my fault :). If you print the values of @rows after the push, what does it say (should say ARRAYREF(0x.....) )?

    CU
    Robartes-

      After the first push it prints out:

      1 : 1111

      After the second push its like:

      2 : 2222
      2 : 2222

      So I'm thinking I'm loosing the reference to the first entry 1 : 1111. But for my purposes I need to be able to access this list after the loop. So do I need fetchrow_array instead of fetchrow_arrayref to be able to keep the previous entries? And if so, how would that change the syntax of the embeded array? Thanks alot! bW