[前台调用]查询单页列表DYCMS

/ / 2019-07-15   阅读:2504
通用页面显示: <?php $sql="select id,title from about where enable=0 order by paixu asc,id asc limit 0,10"; $result=$conn->query($sql); if($result->num_rows>0){ while($data=$...
通用页面显示:
<?php
$sql="select id,title from about where enable=0 order by paixu asc,id asc limit 0,10";
$result=$conn->query($sql);
if($result->num_rows>0){
while($data=$result->fetch_assoc()){
?>
         <li<?php if($id==$data["id"]){echo ' class="on"';}?>>
          <a href="about/show.php?id=<?php echo $data["id"]?>"><?php echo utf_substr($data["title"],20)?></a>
         </li>
<?php
}
}
?>

单页显示:
<?php
$sql="select id,title from ".$tablename." where enable=0 order by paixu asc,id asc limit 0,10";
$result=$conn->query($sql);
if($result->num_rows>0){
while($data=$result->fetch_assoc()){
?>
         <li<?php if($id==$data["id"]){echo ' class="on"';}?>>
          <a href="?id=<?php echo $data["id"]?>"><?php echo utf_substr($data["title"],20)?></a>
         </li>
<?php
}
}
?>

我要评论

昵称:
验证码:

最新评论

共0条 共0页 10条/页 首页 上一页 下一页 尾页
意见反馈