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

2019-07-15阅读:2502

通用页面显示:
<?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
}
}
?>

大家都爱看
查看更多热点文章