in reply to Re: Stuck on an idea..
in thread How to put links in a scroll box?
I have a database with a million zillion names (well not that many, but let's pretend)
I am not really familiar with selectall_arrayref but suspect that all data is loaded into an array (please do correct me if I'm wrong). With a "million zillion" names, this might be a little hard on memory resources. If this is the case, I'd rather go for something like (untested):
my $dbh = DBI->connect($data_source, $user, $password); my $sth = $dbh->prepare("SELECT id, name FROM names_table"); $sth->execute; print "<form method=\"post\" action=\"path/to/script.cgi\">\n"; print "<select name=\"name\">\n"; while(my($id, $name) = $sth->fetchrow_array) { print "<option value=\"$id\">$name</option>\n"; } print "</select>\n"; print "<input type=\"submit\">\n"; print "</form>\n"; $dbh->disconnect;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Stuck on an idea..
by jZed (Prior) on Dec 23, 2003 at 23:18 UTC | |
|
3Re: Stuck on an idea..
by jeffa (Bishop) on Dec 24, 2003 at 17:43 UTC |