设为首页 加入收藏

TOP

MySQL & Perl, 便利之合(四)
2010-12-30 20:32:46 】 浏览:15401
Tags:MySQL Perl 便利
;<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>

首页 上一页 1 2 3 4 5 6 7 下一页 尾页 4/11/11
】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
上一篇MYSQL的简明安装方法 下一篇MYSQL初学者使用指南二

最新文章

热门文章

Hot 文章

Python

C 语言

C++基础

大数据基础

linux编程基础

C/C++面试题目