1 Star 3 Fork 0

毕设研究小组/php毕设图书馆

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
book_Query.php 13.42 KB
一键复制 编辑 原始数据 按行查看 历史
sjm 提交于 2021-07-04 09:31 . first push
<?php session_start();
include("conn.php");
$barcode=$_REQUEST["barcode"];
$bookName=$_REQUEST["bookName"];
$booktype=$_REQUEST["booktype"];
$author=$_REQUEST["author"];
//$translator=$_REQUEST[translator];
$publishing=$_REQUEST["publishing"];
//$price=$_REQUEST[price];
//$page1=$_REQUEST[page1];
$bookcase=$_REQUEST["bookcase"];
?>
<html>
<head>
<title>图书查询</title>
<link href="css/bootstrap.css" rel='stylesheet' type='text/css' />
<link href="css/examples.css" rel="stylesheet" type="text/css">
<link href="css/jquery.fancybox.css" rel="stylesheet" type="text/css">
<link href="css/slider-pro.css" rel='stylesheet' type='text/css' />
<link href="css/timeline.css" rel="stylesheet" type="text/css">
<link href="css/style.css" rel='stylesheet' type='text/css' />
<link href="css/fontawesome-all.css" rel="stylesheet">
<link href="http://fonts.googleapis.com/css?family=Poppins:100,100i,200,200i,300,300i,400,400i,500,500i,600,600i,700,700i,800,800i" rel="stylesheet">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body>
<div class="main-sec">
<?php include"header.php";?>
</div>
<section class="wthree-banner-bottom py-lg-5 py-3" style="background-color: #FFFFFF;margin: 0,0;padding: 0,0;">
<div class=" py-lg-4 py-3"width="auto">
<table align="center" width="100%" border="5px" bordercolor="#ffffff" class="tableBorder_grey" style="background-color: rgb(255,255,255);">
<tr>
<td>
<table height="37" width="100%"border="0" cellpadding="0" cellspacing="0">
<tr>
<td background="images/dangan.gif">
<img src="images/dangan.gif" width="100%"/>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td>
<table align="center">
<tr>
<td>
<div>
<form action=" " method="get">
<select name="gjz" >类型
<option value="barcode" select="<?php if($_GET["gjz"]=="barcode"){ echo "selected";}?>">条形码</option>
<option value="bookname" <?php if($_GET["gjz"]=="bookname"){ ?>selected <?php } ?>>图书名称</option>
<option value="booktype" <?php if($_GET["gjz"]=="booktype"){ ?> selected <?php } ?>>图书类型</option>
<option value="publishing" <?php if($_GET["gjz"]=="publishing"){ ?>selected <?php } ?>>出版社</option>
<option value="stock" <?php if($_GET["gjz"]=="stock"){ ?>selected <?php } ?>>书架</option>
<option value="author" <?php if($_GET["gjz"]=="author"){ ?>selected <?php } ?> >作者</option>
</select>
<input type="text" name="bhnr" placeholder="请输入要查询的关键字" >
<input type="submit"name="submit" value="查询">
</form>
</div>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td>
<?php
if(isset($_GET["submit"])){
$type=$_GET["gjz"];
$neirong=$_GET["bhnr"];
$sql="select * from tb_bookinfo WHERE ".$type." LIKE '%".$neirong."%'";
$pagesize=5;
$query=$mysqli->query($sql);
$result=$query->fetch_array();
$totalNum=$query->num_rows; //2.查出总共有多少条信息
$total=$totalNum;
$page=isset($_GET["page"])?intval($_GET["page"]):1;
$pagecount=ceil($total/$pagesize);
if ($page>$pagecount){
$page=$pagecount; // 对提交过来的page做一些检查
}
if ($page<=0){
$page=1; // 对提交过来的page做一些检查
$pagecount=0;
}
$pre=$page-1; //上一页
$next=$page+1; //下一页
$first=1; //第一页
$last=$pagecount;
if($result==false){
// 输出每行数据
?>
<table width="100%" height="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td height="36" align="center">未查询到图书信息!</td>
</tr>
</table>
<?php
}else{
?>
<table width="98%" height="90%" border="1" cellpadding="0" cellspacing="0" bordercolor="#FFFFFF" bordercolordark="#D2E3E6" bordercolorlight="#FFFFFF">
<tr align="center" bgcolor="#D0E9F8">
<td width="14%">条形码</td>
<td width="24%">图书名称</td>
<td width="20%">图书类型</td>
<td width="17%">出版社</td>
<td width="12%">书架</td>
<td width="13%">作者</td>
<td width="13%">库存</td>
</tr>
<?php
$offset=($page-1)*$pagesize; //偏移量
$sql.=" order by id asc limit $offset,$pagesize";
$result1=$mysqli->query($sql);
while ($row=$result1->fetch_array()){
?>
<tr>
<td style="padding:5px;">&nbsp;<?php echo $row["barcode"];?></td>
<td style="padding:5px;"><a href="booklook.php?bookid=<?php echo $row["id"]; ?>"><?php echo $row["bookname"];?></a></td>
<td style="padding:5px;">&nbsp;<?php echo $row["booktype"];?></td>
<td style="padding:5px;">&nbsp;<?php echo $row["publishing"];?></td>
<td style="padding:5px;">&nbsp;<?php echo $row["bookcase"];?></td>
<td style="padding:5px;">&nbsp;<?php echo $row["author"];?></td>
<?php
$sql="select * from tb_borrow where bookid=".$row["id"];
$query1=$mysqli->query($sql);
$jie=$query1->num_rows;
$num=$row["stock"];
$sum=($num-$jie);
?>
<td style="padding:5px;"><?php if($sum<0){echo "已经借光";} else {echo $sum;}?></td>
</tr>
<?php
}
}
?>
</table>
</td>
</tr>
<tr><td>&nbsp;</td></tr>
<tr>
<td>
<table align="right"style="margin-right: 40px;">
<tr>
<td>当前第<?php echo $page;?>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<?php echo $page."/".$pagecount;?>共页&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<?php echo$pagesize; ?>条/页 共<?php echo $total;?>条记录</td>
<?php
if($page>1){
echo "<td><a href='book_Query.php?gjz=$type&bhnr=$neirong&submit=查询&page=$pre'>上一页</a></td>";
echo "<td><a href='book_Query.php?gjz=$type&bhnr=$neirong&submit=查询&page=1'>首页</a></td>";
}
if($page>5){
$l=$page;
$l_5=$l-5;
echo "<td><a href='book_Query.php?gjz=$type&bhnr=$neirong&submit=查询&page=$l_5'>$l_5</a></td>";
}
if($page>4){
$l=$page;
$l_4=$l-4;
echo "<td><a href='book_Query.php?gjz=$type&bhnr=$neirong&submit=查询&page=$l_4'>$l_4</a></td>";
}
if($page>3){
$l=$page;
$l_3=$l-3;
echo "<td><a href='book_Query.php?gjz=$type&bhnr=$neirong&submit=查询&page=$l_3'>$l_3</a></td>";
}
if($page>2){
$l=$page;
$l_2=$l-2;
echo "<td><a href='book_Query.php?gjz=$type&bhnr=$neirong&submit=查询&page=$l_2'>$l_2</a></td>";
}
if($page>2){
$l=$page;
$l_1=$l-1;
echo "<td><a href='book_Query.php?gjz=$type&bhnr=$neirong&submit=查询&page=$l_1'>$l_1</a></td>";
}
$l=$page;
echo "<td><a href='book_Query.php?gjz=$type&bhnr=$neirong&submit=查询&page=$l'style='color:blue;'>$l</a></td>";
if($page<$pagecount-1){
$l=$page;
$l1=$l+1;
echo "<td><a href='book_Query.php?gjz=$type&bhnr=$neirong&submit=查询&page=$l1'>$l1</a></td>";
}
if($page<$pagecount-2){
$l=$page;
$l2=$l+2;
echo "<td><a href='book_Query.php?gjz=$type&bhnr=$neirong&submit=查询&page=$l2'>$l2</a></td>";
}
if($page<$pagecount-3){
$l=$page;
$l3=$l+3;
echo "<td><a href='book_Query.php?gjz=$type&bhnr=$neirong&submit=查询&page=$l3'>$l3</a></td>";
}
if($page<$pagecount-4){
$l=$page;
$l4=$l+4;
echo "<td><a href='book_Query.php?gjz=$type&bhnr=$neirong&submit=查询&page=$l4'>$l4</a></td>";
}
if($page<$pagecount){
echo "<td><a href='book_Query.php?gjz=$type&bhnr=$neirong&submit=查询&page=$next'>下一页</a></td>";
echo "<td><a href='book_Query.php?gjz=$type&bhnr=$neirong&submit=查询&page=$last'>尾页</a></td>";
}
?>
</tr>
</table>
</td>
</tr>
<tr>
<td><?php
}else{
echo "<table align='center'><tr><td>请输入要查询的关键字,进行查询</td></tr></table>";
}?>
</td>
</tr>
</table>
</div>
</section>
<footer class="footer-sec-w3layouts py-lg-5 py-3" >
<?php include"footer.php";?>
</footer>
<!-- //Custom-JavaScript-File-Links -->
<!-- js -->
<script src="js/jquery-2.2.3.min.js"></script>
<!--slider-->
<!-- banner slider -->
<script src="js/responsiveslides.min.js"></script>
<script>
$(function() {
$("#slider4").responsiveSlides({
auto: true,
pager: true,
nav: false,
speed: 1000,
namespace: "callbacks",
before: function() {
$('.events').append("<li>before event fired.</li>");
},
after: function() {
$('.events').append("<li>after event fired.</li>");
}
});
});
</script>
<!-- //banner slider -->
<!-- dropdown nav -->
<script>
$(document).ready(function() {
$(".dropdown").hover(
function() {
$('.dropdown-menu', this).stop(true, true).slideDown("fast");
$(this).toggleClass('open');
},
function() {
$('.dropdown-menu', this).stop(true, true).slideUp("fast");
$(this).toggleClass('open');
}
);
});
</script>
<!-- //dropdown nav -->
<script src="js/jquery.sliderPro.min.js"></script>
<script src="js/jquery.fancybox.pack.js"></script>
<script>
$(document).ready(function($) {
$('#example2').sliderPro({
width: 350,
height: 400,
visibleSize: '100%',
forceSize: 'fullWidth',
autoSlideSize: true
});
// instantiate fancybox when a link is clicked
$(".slider-pro").each(function() {
var slider = $(this);
slider.find(".sp-image").parent("a").on("click", function(event) {
event.preventDefault();
if (slider.hasClass("sp-swiping") === false) {
var sliderInstance = slider.data("sliderPro"),
isAutoplay = sliderInstance.settings.autoplay;
$.fancybox.open(slider.find(".sp-image").parent("a"), {
index: $(this).parents(".sp-slide").index(),
afterShow: function() {
if (isAutoplay === true) {
sliderInstance.settings.autoplay = false;
sliderInstance.stopAutoplay();
}
},
afterClose: function() {
if (isAutoplay === true) {
sliderInstance.settings.autoplay = true;
sliderInstance.startAutoplay();
}
}
});
}
});
});
});
</script>
<!-- /timeline -->
<script src="js/timeline.min.js"></script>
<script>
timeline(document.querySelectorAll('.timeline'), {
forceVerticalMode: 700,
mode: 'horizontal',
verticalStartPosition: 'left',
visibleItems: 4
});
</script>
<!-- //timeline -->
<!-- //js -->
<script src="js/bootstrap.js"></script>
<!--/ start-smoth-scrolling -->
<script src="js/move-top.js"></script>
<script src="js/easing.js"></script>
<script>
jQuery(document).ready(function($) {
$(".scroll").click(function(event) {
event.preventDefault();
$('html,body').animate({
scrollTop: $(this.hash).offset().top
}, 900);
});
});
</script>
<script>
$(document).ready(function() {
/*
var defaults = {
containerID: 'toTop', // fading element id
containerHoverID: 'toTopHover', // fading element hover id
scrollSpeed: 1200,
easingType: 'linear'
};
*/
$().UItoTop({
easingType: 'easeOutQuart'
});
});
</script>
<!--// end-smoth-scrolling -->
</body>
</html>
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/dearmite/php_big_library.git
git@gitee.com:dearmite/php_big_library.git
dearmite
php_big_library
php毕设图书馆
master

搜索帮助