But you are using a hash, so keys is not guaranteed to put things in the
same order you want them to be in...

sort keys %loc would work...

Jeff

> -----Original Message-----
> From: Hytham Shehab [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, July 25, 2002 3:37 PM
> To: dbi
> Subject: Re: it *should* be sorted, but it is not
>
>
> here is a code snippet:
>
> $locationh = $dbh->prepare_cached("select id,name from location
> where id<100
> order by id");
> $locationh ->execute();
> while (@row=$locationh->fetchrow_array) {
> $loc{$row[0]} = $row[1];
> }
> now, when i get the %loc and print it as a key,value pairs, it
> gives me the
> wrong order:
>
> <option value=2>zone2</option>
> <option value=1>zone2</option>
>
> which is not what i want, what i want is
>
> <option value=1>zone1</option>
>
> <option value=2>zone2</option>
>
> thats it, i hope this could make it more clarified.
>
> thanks guys
>
> --
>
> Hytham Shehab
>
>
>


Reply via email to