Code:
-
-
-
- $sql_former = "select * from article where id<$id order by id desc ";
- $sql_later = "select * from article where id>$id ";
- $queryset_former = mysql_query($sql_former);
- if(mysql_num_rows($queryset_former)){
- $result = mysql_fetch_array($queryset_former);
- echo "Previous post ". $result [title]."
";
- } else {echo "Previous post No more
";}
- // www.jbxue.com
- $queryset_later = mysql_query($sql_later);
- if(mysql_num_rows($queryset_later)){
- $result = mysql_fetch_array($queryset_later);
- echo "Next article ". $result ['title']."
";
- } else {echo "Next article No more
";}
- ?>
http://www.bkjia.com/PHPjc/729837.htmlwww.bkjia.comtruehttp: //www.bkjia.com/PHPjc/729837.htmlTechArticleCode: ?php //----Display previous and next article code START--- - $sql_former = "select*fromarticlewhereid$idorderbyiddesc"; //SQL statement of the previous article. Note that it is in reverse order, because...
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