分页mysqlphp
$conn=mysql_connect('localhost','root','admin') or die('could not connect: '.mysql_error());
mysql_select_db('sybgtjxt') or die('could not select database');
mysql_query("set names gbk" );
if(mysqli_connect_errno()){
echo"数据库连接失败";
}
else{
$pagesize=5;
if($_get['page']!='')
$page=$_get['page'];
else {
$page=1;
}
$sql1="select * from tblreport where is_modify=0 order by sid desc";
$rs=mysql_query($sql1); $numRecord=mysql_num_rows($rs); //echo"$numRecord"; //echo "$page"; $totalpage=ceil($numRecord/$pagesize); //echo"$totalpage"; $recordSql=$sql1." limit ".(($page-1)*$pagesize).",".$pagesize; $result=mysql_query($recordSql); //if($result) //echo"成功"; // else //echo "失败"; //$rst=mysql_fetch_array($rs); //echo $rst['pname']; }?>
立即学习“PHP免费学习笔记(深入)”;
<table width="100%" border="1" cellpadding="0" cellspacing="0" bordercolor="#fcc898" style="height: 25px"> <tr> <td width="3%" bgcolor="#FCEBE3" style="height: 16px"> @@##@@ <font style="font-size: 14px">作业评分>>批改作业</font> </td> </tr></table><table> <tr> <td> 学生姓名: </td> <td style="width: 83px"> <input name="sname" type="text" id="sname" style="border-style:Groove;width:120px;" /> </td> <td> <input type="submit" name="Append" value="查询" id="Append" class="redButtonCss" /> </td> </tr></table><table width="100%" cellpadding="0" cellspacing="0" border="0" align="center"> <tr style="line-height: 27px"> <td align="center" colspan="2"> <div id="Panel1" style="width:100%;text-align:right;"> <div> <?php while($rst=mysql_fetch_array($result)){ ?> <table cellspacing="0" cellpadding="0" rules="all" border="1" id="gridview" style="color:#333333;border-color:#FCC898;border-width:1px;border-style:solid;width:100%;border-collapse:collapse;"> <tr class="TrCss" align="center" style="background-color:#ECE8E9;font-weight:normal;height:27px;"> <th scope="col" style="border-color:#FCC898;border-width:1px;border-style:solid;font-weight:normal;height:27px;width:80px;">学生编号</th> <th scope="col" style="border-color:#FCC898;border-width:1px;border-style:solid;font-weight:normal;height:27px;width:200px;">报告名称</th> <th scope="col" style="border-color:#FCC898;border-width:1px;border-style:solid;font-weight:normal;height:27px;">任课老师</th> <th scope="col" style="border-color:#FCC898;border-width:1px;border-style:solid;font-weight:normal;height:27px;">学生姓名</th> <th scope="col" style="border-color:#FCC898;border-width:1px;border-style:solid;font-weight:normal;height:27px;width:100px;">操作</th> </tr><tr align="center" style="color:#333333;background-color:White;border-color:#FCC898;border-width:1px;border-style:solid;"> <td style="border-color:#FCC898;border-width:1px;border-style:solid;font-weight:normal;width:80px;"> <!--学生编号--><?php $sql2="select * from tblstudent where sid='$rst[sid]'"; $re_s2=mysql_query($sql2); $rst_s2=mysql_fetch_array($re_s2); echo $rst['sid']?> </td><td style="border-color:#FCC898;border-width:1px;border-style:solid;font-weight:normal;width:200px;"> <!--报告名称--><?php echo $rst['pname']?> </a> </td><td style="border-color:#FCC898;border-width:1px;border-style:solid;font-weight:normal;"> <!--老师名字--><?php echo $rst['tname']?> </td><td style="border-color:#FCC898;border-width:1px;border-style:solid;font-weight:normal;"> <!--姓名--><?php echo $rst_s2['sname']?> </td><td style="border-color:#FCC898;border-width:1px;border-style:solid;font-weight:normal;width:100px;"> <a href="Pigai.#">批改</a> <br /> </td> </tr> </table></div>
}
?>
立即学习“PHP免费学习笔记(深入)”;
立即学习“PHP免费学习笔记(深入)”;
0) echo $page-1;?>'>上一页
</div><!-- 页码结束-->
PHP怎么学习?PHP怎么入门?PHP在哪学?PHP怎么学才快?不用担心,这里为大家提供了PHP速学教程(入门到精通),有需要的小伙伴保存下载就能学习啦!
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号