Beefy Boxes and Bandwidth Generously Provided by pair Networks RobOMonk
Keep It Simple, Stupid
 
PerlMonks  

Re: DBI returning mysql columns in strange order.

by shenme (Priest)
on Oct 09, 2003 at 17:42 UTC ( [id://298117]=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.

Keys of a hash are not returned in any particular order.   Try
# get column names foreach $col (sort keys %{$ref}){
to get your keys in alpha sorted order.   If you want them in another order, you will have to create an array to define the order you want and do something like
# get column names my @col_order = qw( Condition Cshift ); foreach $col (@col_order){
but then you might run into problems with getting the casing of your names correct.

What you _really_ want to do is find out the order of your fields directly from the DB and   ...   I don't remember how to do that just now. :-(   Check the docs and you'll find it I'm sure.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://298117]
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.