Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
Thanksprint "Content-type: text/html\n\n"; use DBI; # database information # make connection to database $dbh = DBI->connect($connectionInfo,$userid,$passwd); # prepare and execute query $query = "SELECT * FROM employees ORDER BY lastName, firstName"; $sth = $dbh->prepare($query); $sth->execute(); # assign fields to variables $sth->bind_columns(undef, \$employeeID, \$firstName, \$lastName); print "Employees in the inventory database:<p>"; print "<form action=\"displayResults.pl\" method=post>"; print "<select name=employeeID><option value=\"\">Select an employee</ +option>"; # output employee list to browser as drop-down listings while($sth->fetch()) { print "<option value=$employeeID>$firstName $lastName</option>"; } print "</select><input type=submit name=submit value=submit></form>"; $sth->finish(); #disconnect from database $dbh->disconnect;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: CGI DBI refining results
by pajout (Curate) on Nov 28, 2005 at 11:04 UTC | |
by Anonymous Monk on Nov 28, 2005 at 11:11 UTC | |
by Delusional (Beadle) on Nov 28, 2005 at 11:31 UTC | |
by pajout (Curate) on Nov 28, 2005 at 11:40 UTC |