Beefy Boxes and Bandwidth Generously Provided by pair Networks Cowboy Neal with Hat
laziness, impatience, and hubris
 
PerlMonks  

Re: DBI returning mysql columns in strange order.

by runrig (Abbot)
on Oct 09, 2003 at 17:42 UTC ( [id://298118]=note: print w/replies, xml ) Need Help??

This is an archived low-energy page for bots and other anonmyous visitors. Please sign up if you are a human and want to interact.


in reply to DBI returning mysql columns in strange order.

There is no order to keys of a hash array (unless you think that random == ordered ). If you want order, you can get it by using the NAME or NAME_lc attribute of the statement handle to get the order of selected columns, e.g.:
$sth->execute; my @columns = @{ $sth->{NAME_lc} }; my %row; $sth->bind_columns(\@row{@columns}); while ($sth->fetch) { for (@columns) { print "$_ = $row{$_}\n"; } }
Updated.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://298118]
help
Sections?
Information?
Find Nodes?
Leftovers?
    Notices?
    hippoepoptai's answer Re: how do I set a cookie and redirect was blessed by hippo!
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.