in reply to scrolling list

I think I have done what you are trying to do a million times, tell me if this is what you are looking for. Basically first do the assumed code to get the array:
my $sth = $dbh->prepare("SELECT stuff FROM table"); $sth->execute; my @data = $sth->fetchrow_array;
Then you have a nice array with all the elements of your sql return. Then just setup the select and itterate through this array like so:
print "<select name = 'test'>"; foreach my $entry ( @data ) { print "<option value = '$entry'>$entry</option>"; } print "</select>";
And if what is what you are looking for, then there is a simple answer, if not, BUGGER OFF! Tradez

Replies are listed 'Best First'.
Re: Another simple answer by tradez
by gmax (Abbot) on Dec 21, 2001 at 18:22 UTC
    If you have done this a million times, I am afraid that you could end up with a million errors.
    Your statement my @data = $sth->fetchrow_array; will only fetch the first row from the result set. After which, if you don't call $sth->finish(), you'll end up with some memory being allocated and unreleased.
    Check the above answer by Chmrr for a correct use of fetchrow_array with while.

    BTW, your comment that the enquiring monk should B... OFF is not going to do much good for his problem.
     _  _ _  _  
    (_|| | |(_|><
     _|
    
    For every complex problem, there is a solution that is simple, neat, and wrong
    H. L. Mencken