<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <link rel="stylesheet" type="text/css" href="bootstrap.min.css"> <script type="text/javascript" src="bootstrap.min.js"></script> <title>商家资料入驻详情</title> </head> <style type="text/css"> body{ background-color: #ccc; } </style> <body> <div class="container"> <div class="jumbotron"> <h1>商家入驻详情</h1> <p>您的决定已经把握住了商机!</p> </div> <table class="table table-striped"> <caption>入驻商家信息表</caption> <thead> <tr> <th>序号</th> <th>商家名称</th> <th>地区</th> <th>联系人</th> <th>电话</th> <th>行业</th> </tr> </thead> <?php $link=mysqli_connect(‘127.0.0.1‘,‘root‘,‘‘,‘labor‘); mysqli_query($link,"SET NAMES ‘utf8‘"); $page=""; if ($page=="") {$page=1;}; $pagesize=10; //定义每页显示多少条记录 $page=isset($_GET["page"])?intval($_GET["page"]):1; //定义page的初始值,如果get 传过来的page为空,则page=1, $total=mysqli_num_rows(mysqli_query($link,"select * from login order by id ")); //执行查询获取总记录数 $pagecount=ceil($total/$pagesize); //计算出总页b数 if ($page>$pagecount){ $page=$pagecount; // 对提交过来的page做一些检查 } if ($page<=0){ $page=1; // 对提交过来的page做一些检查 } $offset=($page-1)*$pagesize; //偏移量 $pre=$page-1; //上一页 $next=$page+1; //下一页 $first=1; //第一页 $last=$pagecount; //末页 $exec="select * from login limit $offset,$pagesize"; //执行查询 $result=mysqli_query($link,$exec); while ($data=mysqli_fetch_array($result)){ ?> <tbody> <tr> <td><?php echo $data[‘id‘]; ?></td> <td><?php echo $data[‘Cname‘]; ?></td> <td><?php echo $data[‘address‘]; ?></td> <td><?php echo $data[‘linkman‘]; ?></td> <td><?php echo $data[‘tele‘]; ?></td> <td><?php echo $data[‘type‘]; ?></td> </tr> </tbody> <?php } ?> </table> <div>页<?php echo $page."/".$pagecount?>总页 <a href="?page=1">首页 </a><a href="?page=<?php echo $pre?>">上一页</a> <a href="?page=<?php echo $next?>">下一页</a><a href="?page=<?php echo $last?>"> 尾页</a></div> </div> </body> </html>
结合了前端的bootstrap
时间: 2024-11-10 01:34:33