加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
book_bidu.php 11.18 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 width="100%" align="center">
<tr>
<td>
<table width="100%" height="37" border="0" cellpadding="0" cellspacing="0">
<tr>
<td><img src="images/dangan.gif" width="100%"/></td>
</tr>
</table>
</td>
</tr>
<tr>
<td>
<?php
$sql="select * from tb_bookinfo where bidu=1";
$pagesize=5;
$query=$mysqli->query($sql);
$result=$query->fetch_array();
$totalNum=$query->num_rows; //2.查出总共有多少条信息
$pagecount=(int)(($totalNum-1)/$pagesize)+1;
if($result==false){
?>
<table width="100%" height="30" border="0" cellpadding="0" cellspacing="0">
<tr>
<td height="36" align="center">暂无必读图书信息!</td>
</tr>
</table>
<?php
}
else{
$page_len=7;
$max_p=$pagecount;
$pages=$pagecount;
//判断当前页码
if(empty($_GET['page'])||$_GET['page']<0){
$page=1;
}else {
$page=$_GET['page'];
}
?>
<table width="98%" 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>
</tr>
<?php
$offset=$pagesize*($page-1);
$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="book_view.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;"><?php echo $row["stock"];?></td>
</tr>
<?php
}
}
?>
</table>
</td>
</tr>
<tr><td>&nbsp;</td></tr>
<tr>
<td>
<table align="right"style="margin-right: 40px;">
<tr>
<td>
<?php
$page_len = ($page_len%2)?$page_len:$pagelen+1;//页码个数
$pageoffset = ($page_len-1)/2;//页码个数左右偏移量
$key='<div class="page">';
$key.="<span>共$totalNum 条记录$pagesize/条每页</span> "; //第几页,共几页
$key.="<span>$page/$pages</span> "; //第几页,共几页
if($page!=1){
$key.="<a href=\"".$_SERVER['PHP_SELF']."?page=1&parcode=".($parcode)."&bookName=".($bookName)."&page1=".($page1)."&price=".($price)."&bookcase=".($bookcase)."&publishing=".($publishing)."&translator=".($translator)."&author=".($author)."&booktype=".($booktype)."\">第一页</a> "; //第一页
$key.="<a href=\"".$_SERVER['PHP_SELF']."?page=".($page-1)."&parcode=".($parcode)."&bookName=".($bookName)."&page1=".($page1)."&price=".($price)."&bookcase=".($bookcase)."&publishing=".($publishing)."&translator=".($translator)."&author=".($author)."&booktype=".($booktype)."\">上一页</a>"; //上一页
}else {
$key.="第一页 ";//第一页
$key.="上一页"; //上一页
}
if($pages>$page_len){
//如果当前页小于等于左偏移
if($page<=$pageoffset){
$init=1;
$max_p = $page_len;
}else{//如果当前页大于左偏移
//如果当前页码右偏移超出最大分页数
if($page+$pageoffset>=$pages+1){
$init = $pages-$page_len+1;
}else{
//左右偏移都存在时的计算
$init = $page-$pageoffset;
$max_p = $page+$pageoffset;
}
}
}
for($i=$init;$i<=$max_p;$i++){
if($i==$page){
$key.=' <span>'.$i.'</span>';
} else {
$key.=" <a href=\"".$_SERVER['PHP_SELF']."?page=".$i."&parcode=".($parcode)."&bookName=".($bookName)."&page1=".($page1)."&price=".($price)."&bookcase=".($bookcase)."&publishing=".($publishing)."&translator=".($translator)."&author=".($author)."&booktype=".($booktype)."\">".$i."</a>";
}
}
if($page!=$pages){
$key.=" <a href=\"".$_SERVER['PHP_SELF']."?page=".($page+1)."&parcode=".($parcode)."&bookName=".($bookName)."&page1=".($page1)."&price=".($price)."&bookcase=".($bookcase)."&publishing=".($publishing)."&translator=".($translator)."&author=".($author)."&booktype=".($booktype)."\">下一页</a> ";//下一页
$key.="<a href=\"".$_SERVER['PHP_SELF']."?page=".$pages."&parcode=".($parcode)."&bookName=".($bookName)."&page1=".($page1)."&price=".($price)."&bookcase=".($bookcase)."&publishing=".($publishing)."&translator=".($translator)."&author=".($author)."&booktype=".($booktype)."\">最后一页</a>"; //最后一页
}else {
$key.="下一页 ";//下一页
$key.="最后一页"; //最后一页
}
$key.='</div>';
?>
<?php echo $key?>
</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 助手
尝试更多
代码解读
代码找茬
代码优化