;<form action="/cgi-bin/lf.cgi" method="get">
# Here
comes the button's title for the launching page
<input type="submit"
value=" LFAuth ">
</form>
</TD>
</TR>
</TABLE> 下面用脚本去查询数据库。
<center><H2>Search by author</H2></center>
<form action="/cgi-bin/lf.cgi" method="get">Author name :
<input
type="text" size="30" name="author"><input type="submit"
value="Search..."></form></center>
END_of_start
if (param("author") ne '') {
$author = param("author");
$autsrch.='"';
$autsrch.=$author;
$autsrch.='"';
# We
connect to the database named lf as user doe
$dbh =
DBI->connect("DBI:mysql:lf","doe",'');
$sth = $dbh->prepare("
select *
from trissue
where
author = $autsrch
");
$sth->execute;
接着用脚本去显示查询结果。如果我们不限制查询条件,将会显示出数据库的所有内容,如果我们提供一个作者姓名,则会显示出与该作者相关的所有文章。当你的数据库有上千条记录时,不推荐显示出所有内容!
print <<END_suite;
<center>
<TABLE
BORDER=>
<tr bgcolor=#A1C4EE>
<th width=60
align=CENTER><font color=#000000> Num </font></th>