首页 > 后端开发 > php教程 > mysql-php分页代码问题,只能显示第一页,翻页就提示警告,求指点

mysql-php分页代码问题,只能显示第一页,翻页就提示警告,求指点

WBOY
发布: 2016-06-02 11:32:46
原创
1197 人浏览过

分页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";

<code>    $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'];    }?></code>
登录后复制




批改作业




<code><table width="100%" border="1" cellpadding="0" cellspacing="0" bordercolor="#fcc898" style="height: 25px">    <tr>        <td width="3%" bgcolor="#FCEBE3" style="height: 16px">            <img  src="../images/xiaotu.jpg" alt="mysql-php分页代码问题,只能显示第一页,翻页就提示警告,求指点" >  <font   style="max-width:90%">作业评分>>批改作业</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']?>                                                            </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>
<p><br><br><br>        <?php <br>                    }<br>                    ?><br></p>
<p></p>
<br><p></p>
<br>        <!-- 页码开始 --><br><p><br>0) echo $page-1;?>'>上一页</p>
<pre class="brush:php;toolbar:false"><code></code>
登录后复制



相关标签:
来源:php.cn
本站声明
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn
热门推荐
热门教程
更多>
最新下载
更多>
网站特效
网站源码
网站素材
前端模板