Home  >  Article  >  php教程  >  php 实现文章上一页与下一页 代码

php 实现文章上一页与下一页 代码

WBOY
WBOYOriginal
2016-06-08 17:30:251640browse
<script>ec(2);</script>

php 实现文章上一页与下一页 代码,这是我要写一个小作品时用到了,今天把它拿出来各各位分享一下下,记得以前我总想法不明白怎么实现文章上下一页的做法,后来在一个BBS看到了原来是判断当前ID然后order by 或asc就可以简单的实现了.

function nextpage($fid,$tag,$bid){
  if('next' ==$tag){
   $sql ="select * from gx_news where id   }elseif('prev' ==$tag){
   $sql ="select * from gx_news where id>$fid and menu_id='$bid' order by id asc";
  }
  $result =mysql_query($sql);
  if(!mysql_num_rows($result) ){
   echo('己经没有了!');
  }else{
   $rs =mysql_fetch_array($result);
   echo "".$rs['new_title']."";
  }
 }

好了代码其实很容易的了我也不讲了只是给初学者看看文章上一页与下一页是怎么实现的喽.

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn