首页 > 后端开发 > php教程 > 图书管理程序(三)_PHP

图书管理程序(三)_PHP

WBOY
发布: 2016-06-01 12:29:25
原创
867 人浏览过

图书查询部分:

if(!$UploadAction):
?>

//本程序是为输出书名,作者、出版社资料而设。
//编者:孔秀祥。日期:2001/3/25
?>


书目查询


ACTION= " $PHP_SELF ?>" METHOD = "POST">







著作名
作者
出版社
出版日期

ISBN












else:
session_start();
require "config.php3";

$b_price=$b_price_a.".".$b_price_b;

$UploadAction=0;
$repeat=0; //是不是重复了。
$TimeLimit=0; //设置超时限制时间缺省时间为 30秒设置为0时为不限时
set_time_limit($TimeLimit);
@MYSQL_CONNECT($hostname,$dbusername,$dbpassword) OR DIE("不能连接数据库!");
@mysql_select_db("$dbname") or die("不能选择数据库!");
//$q="select books.books_id, books.books_name,author.first_name,author.last_name,publisher.publisher_name from books,author,books_author,publisher where books.books_name="$b_name" and books.publisher_id=publisher.publisher_id and books.books_id=books_author.books_id and books_author.author_id=author.author_id";
if($b_name!="")
$bn="books.books_name="$b_name" and ";
if($p_name!="")
$pn="publisher.publisher_name="$p_name" and ";
if($a_first1!="")
$af="author.first_name="$a_first1" and ";
if($a_last1!="")
$al="author.last_name="$a_last1" and ";
if($p_year!=""){
$date_p="books.date_pub rlike '^$p_year.*' and ";
}
if($isbn!="")
$is="books.ISBN="$isbn" and ";
$q="select books.books_id, books.books_name,author.first_name,author.last_name,publisher.publisher_name from books,author,books_author,publisher
where $bn $pn $af $al $date_p $is books.publisher_id=publisher.publisher_id and books.books_id=books_author.books_id and books_author.author_id=author.author_id order by books.books_name";


$r = @mysql_query($q);
if(!$r){
echo "查询无效
";
exit;
}
if(mysql_num_rows($r) $msg="没有符合要求的记录。";
xueroom_error_exit($msg,$PHP_SELF);

}

while($count=mysql_fetch_array($r)){
$books_id=$count[0];
$books_name=$count[1];
$first_name=$count[2];
$last_name=$count[3];
$publisher_name=$count[4];
if($book!=$books_id){
$repeat ;
echo "
".$repeat."、";
echo "《".$books_name."》";
echo "出版社:".$count[4];
echo "  作者:";
}
echo "$first_name$last_name ";
$book=$books_id;
}

echo"
返回 ";
echo"
相关标签:
来源:php.cn
本站声明
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn
热门教程
更多>
最新下载
更多>
网站特效
网站源码
网站素材
前端模板