Why you don't change your SQL statement, that way you would get the values in right order ...
because the values may come out of the database in the right order, but the map() used to create the hash destroys the order. (i've tested this, actually.) | [reply] [d/l] |
Hi again,
What I don't understand is why you are using a hash for this, it's not necessary, you can use the result array, it gives you the right order... taking the result and then copying it to a hash is not necessary.
And if you want to do it with hashes, because you want to, you can use sorted hashes or use a complexe sort method...
But really, don't understand why you need a hash in this case.
Regards,
|fire| at irc.freenode.net
| [reply] |
What I don't understand is why you are using a hash for this, it's not necessary, you can use the result array, it gives you the right order... taking the result and then copying it to a hash is not necessary.
well, in order to have the labels for the scrolling_llist different than the values, per the CGI documentation, an array of values and a hash of value -> label mappings *is* needed.
i'm creating:
<select>
<option value='1'>Foo </option>
<option value='3'>Baz </option>
</select>
now i realize that hashes are nothing more than special arrays, *but* in order to create the sample above, CGI::scrolling_list requires an array of values *and* the (optional) hash of label mappings.
i haven't tried to let perl massage the resulting array into a hash, *but* it's also an arrayref of hashrefs (as i've written the fetch), and CGI::scrolling_list doesn't understand that. | [reply] [d/l] |