| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 1864 人关注过本帖
标题:分页源代码,分页时上一页下一页不显示,但可以跳转
只看楼主 加入收藏
guaishi
Rank: 1
等 级:新手上路
帖 子:156
专家分:0
注 册:2007-6-15
结帖率:100%
收藏
 问题点数:0 回复次数:0 
分页源代码,分页时上一页下一页不显示,但可以跳转
<?php $key=$_REQUEST["key"];
             $sql="select * from product where pronum like'%$key%' or pdes like '%$key%'";
              $page=$_REQUEST["page"];
              $ss=mysql_query($sql,$conn);
             $row1=mysql_fetch_array($ss);
             $num=$row1[0];
             if($num>0)
             {
              if (empty($_GET['page']))
              { $page=1;}
              else
              {$page=$_GET['page'];}
              if($page<1)$page=1;
if($page>=ceil($num/5)) $page=ceil($num/5);
$sql1="select * from product where pronum like'%$key%' or pdes like '%$key%' limit ".($page*5).",5";
//echo $sql1;
$rest1=mysql_query($sql1,$conn);
  ?>
              <table width="100%" border="1">
                <tr>
                  <td width="159">Product</td>
                  <td width="406">Description</td>
                </tr>
                <?php
                while($row=mysql_fetch_array($rest1))
            { ?>
                <tr>
                  <td><?php echo $row["pronum"]?></td>
                  <td><?php echo $row["pdes"]?></td>
                </tr>
                <?php }?>
              </table>
              <?php if($page==1)
                 {  ?>
                <span class="STYLE7">firsPage</span>&nbsp;
                <span class="STYLE7">PrevPage</span>&nbsp;
                
                
                 <?php
                  }
                  else
                  {?>
                <a href="pproduct.php?page=1"><span class="STYLE7">firsPage </span></a>&nbsp;&nbsp;
                <a href="pproduct.php?page=<? echo($page-1) ?>"class="STYLE7">PrevPage</a>
                <? } ?>
                  <?php if($page==ceil($num/5))
                  { ?> <span class="STYLE5">nextPage</span>&nbsp;
                   <span class="STYLE7">LastPage</span>&nbsp;&nbsp;&nbsp;
                 <?php }
                  else
                   { ?> <a href="pproduct.php?page=<? echo ($page+1) ?>" class="STYLE5">nextPage</a>&nbsp;&nbsp;&nbsp;&nbsp;
                  
 <a href="pproduct.php?page=<?=ceil($num/5)?>">LastPage</a>&nbsp;&nbsp;&nbsp;&nbsp;
                   
                   <?PHP  }
                 }
                  
                  else
                  {echo"<script language=javascript>alert('NO recordset');window.location.href='product.php';</script>";
                  } ?>              </td>
          <td width="7%" valign="top"><img src="images/c_2.gif" alt="evoc" width="68" height="304" /></td>
      </tr>
      
      
    </table>
                </td>
            </tr>
            <tr>
                <td background="images/a_27_1.gif" style="height: 44px">
                    <table border="0" cellpadding="0" cellspacing="0" height="40" width="100%">
                        <tr>
                            <td style="width: 9%; height: 35px">&nbsp;
                                </td>
                            <td align="center" style="height: 35px" valign="bottom" width="56%">
                                <span class="font1 STYLE5" style="color: #333333">Copyright &copy; 1998-2008 EVOC INTELLIGENT TECHNOLOGY CO., LTD </span>
                            </td>
                            <td style="color: #333333; height: 35px" width="31%">&nbsp;
                                </td>
                        </tr>
                    </table>
                </td>
            </tr>
            <tr>
                <td>
                    <img height="37" src="images/a_28.gif" width="1003" /></td>
            </tr>
        </table>
   
        <script src="http://www. type="text/javascript">
</script>
<script type="text/javascript">
_uacct = "UA-1708392-2";
urchinTracker();
</script>
搜索更多相关主题的帖子: 源代码 page num key GET 
2008-05-04 09:30
快速回复:分页源代码,分页时上一页下一页不显示,但可以跳转
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.068769 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved