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

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

WBOY
WBOYOriginal
2016-06-02 11:32:461189Durchsuche

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



Stellungnahme:
Der Inhalt dieses Artikels wird freiwillig von Internetnutzern beigesteuert und das Urheberrecht liegt beim ursprünglichen Autor. Diese Website übernimmt keine entsprechende rechtliche Verantwortung. Wenn Sie Inhalte finden, bei denen der Verdacht eines Plagiats oder einer Rechtsverletzung besteht, wenden Sie sich bitte an admin@php.cn
Vorheriger Artikel:php如何以json格式传输图片的二进制形式Nächster Artikel:php-聊天页面自动输出数据库记录,ajax怎么来用

In Verbindung stehende Artikel

Mehr sehen