下面是新闻模型举列子,如果要自己的模型的就调自己的表
较新一篇:
<?php
$infoPreNext = $empire->fetch1("
select * from {$dbtbpre}ecms_news
where classid=$GLOBALS[navclassid]
and checked=1
and newstime>$navinfor[newstime]
order by newstime asc limit 1;
");
if(empty($infoPreNext[id])){
echo "没有了";
}else{
echo "<a href='".sys_ReturnBqTitleLink($infoPreNext)."'>
<img src='".$infoPreNext[titlepic]."'>
</a>";
}
?>
较早前一篇:
<?php
$infoPreNext = $empire->fetch1("select * from {$dbtbpre}ecms_news where classid=$GLOBALS[navclassid] and checked=1 and newstime<$navinfor[newstime] order by newstime desc limit 1;");
if(empty($infoPreNext[id])){
echo "没有了";
}else{
echo "<a href='".sys_ReturnBqTitleLink($infoPreNext)."'><img src='".$infoPreNext[titlepic]."'></a>";
}
?>