Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re: Re: Re: Re: Can't retrieve all records

by arthas (Hermit)
on Jun 03, 2003 at 21:32 UTC ( [id://262801]=note: print w/replies, xml ) Need Help??


in reply to Re: Re: Re: Can't retrieve all records
in thread Can't retrieve all records

fetchrow_arrayref() returns you an array reference, so you should use it in a way like this:

while (my $track_ref = $sth->fetchrow_arrayref ()) { print $$track_ref[0]; # This prints the first field print $$track_ref[1]; # This prints the second field # ...and so on }
If you plan to use this method, it's a good practice to avoid SELECT *, and specify in the query all the fields in the order you expect them to be. It works even with the first syntax, however you're going to need to adjust your code if for some reason you recreate your table with a different field order or with additional fields inserted in the middle.

Michele.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://262801]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others rifling through the Monastery: (5)
As of 2024-04-20 00:13 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found