PHP结课报告 《会员信息管理系统》
发布时间:2023-03-13 14:04:29 所属栏目:教程 来源:
导读://每一个小标题都需要建一个PHP文件
数据库快速连接:
<?PHP
//连接数据库
$link = MysqLi_connect("localhost","root","123456","数据库名","3306");
if($link == false)
{
die("连接数据库失败!")
数据库快速连接:
<?PHP
//连接数据库
$link = MysqLi_connect("localhost","root","123456","数据库名","3306");
if($link == false)
{
die("连接数据库失败!")
//每一个小标题都需要建一个PHP文件 数据库快速连接: <?PHP //连接数据库 $link = MysqLi_connect("localhost","root","123456","数据库名","3306"); if($link == false) { die("连接数据库失败!"); } ?> 首页代码: <?PHP //连接数据库 include_once "sqlcon.PHP"; $sql=<<<ztbu select * from student; ztbu; $query = MysqLi_query($link,$sql); $infos = MysqLi_fetch_all($query,MysqLI_ASSOC); //定义分页 //每页信息条数 $perpage=5; //总信息条数 $total_num=count($infos); //总页数 $total_page=ceil($total_num/$perpage); //第一页 $page=isset($_GET['page'])?$_GET['page']:1; //设定第一条信息 $start_index=$perpage*($page-1); //最后一条信息 $end_index=$perpage*$page-1; $end_index=min($end_index,$total_num-1); ?> <style> html{ background-color: bisque; } #login_div{ height: 200px; background-color: bisque; } #td{ font-size: 20px; font-weight: bolder; } #head{ position: absolute; padding-left: 500px; top: 100px; } .show{ position: relative; width: 800px; left: 270px; bottom: 50px; background-color: aliceblue; border:thin solid black; height: 400px; overflow-x: hidden; overflow-y: scroll; line-height: 30px; } .select{ position: relative; left: 700px; top:-107px; } .denglu{ position: absolute; right: 450px; top: 103px; z-index: 99; } .zhuce { position: absolute; right: 390px; top: 103px; z-index: 99; } </style> <head> <Meta charset="utf-8"> <title>会员信息管理系统</title> </head> <body style="background-image: url('img/1.png')"> <!--登录注册添加跳转界面--> <div id="login_div" style="background-image: url('img/1.png')"> <button class="denglu"><a href="loginfront.PHP">登录</a></button> <button class="zhuce"><a href=" zhuce.PHP">注册</a></button> </div> <!--#首页标签--> <div align="center" id="head"> <tr> <td><a href="login.PHP" id="td" style=" position: relative;left: -200px;">首页</a></td> <td><a href="insert.PHP" id="td" style=" position: relative;left: -100px;">添加</a></td> <td><a href="alter.PHP" id="td">修改</a></td> </tr> </div> <!--搜索栏--> <div> <form action="selectok.PHP" method="post" class="select"> <tr> <td ><input type="text" name="text" value="请输入关键词进行搜索" onclick="this.value=''"></td> <td> <button name="select" style="margin-left: 20px">搜索</button></td> </tr> </form> </div> <!--信息展示窗口--> <div class="show"> <h1 align="center">会员信息表</h1> <table border="1" align="center" width="783" cellspacing="1" cellpadding="1" bgcolor="#ffe4c4"> <tr align="center"> <th>编号</th> <th>姓名</th> <th>性别</th> <th>年龄</th> <th>地址</th> </tr> <?PHP for($i=$start_index;$i<=$end_index;$i++) { echo "<tr>"; echo "<td align='center'>",$infos[$i]["id"],"</td>"; echo "<td align='center'>",$infos[$i]["name"],$infos[$i]["sex"],$infos[$i]["age"],$infos[$i]["adress"],"</td>"; echo "</tr>"; } echo '<tr>'; echo "<td colspan='5' align='center'><a href='?page=1' >【首页】</a>"; $prepage=($page-1)<1?1:($page-1); //判断当前页是否为首页,若为首页,则上一页的超链接无效,仍为首页 echo "<a href='?page=$prepage'>【上一页】</a>"; $nextpage=($page+1)>$total_page?$total_page:($page+1); //判断当前页是否为尾页,若为尾页,则下一页的超链接无效,仍为尾页 echo "<a href='?page=$nextpage'>【下一页】</a>"; echo "<a href='?page=$total_page'>【尾页】</a>"; echo "</td></tr>"; ?> </table> </div> </body> (编辑:汽车网) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
推荐文章
站长推荐