<?php
header('Content-Type: text/html; charset=utf-8');
mysql_connect('localhost','root','123456') or die(mysql_error());
mysql_select_db('cc');
mysql_query("set names 'utf8'");
$id =$_GET['id'];//是你当前文章的编
$sql ="select * from string_find where id>$id order by id asc limit 0,1";
//上一篇文章
$sql1 ="select * from string_find where id<$id order by id desc limit 0,1";
//下一篇文
$result = mysql_query($sql);
if( mysql_num_rows( $result )) {
$rs = mysql_fetch_array( $result );
echo "<a href='f.php?id=".$rs[0]."'>下一篇</a>".$rs[0];
} else {
echo "没有了";
}
$result1 = mysql_query( $sql1);
if( mysql_num_rows($result1))
{
$rs1 = mysql_fetch_array( $result1 );
echo "<a href='f.php?id=".$rs1[0]."'>上一篇</a>".$rs1[0];
} else {
echo "没有了";
}
?>
文章上一篇 下一篇 功能
最新推荐文章于 2021-07-21 18:09:10 发布