我做了一个后台,然后我想让他在前台显示东西,就是类似于商品展示,上面是大类 然后下面的标题我想让他加上连接怎么只读取数据库中的这条信息的最新内容显示在前台类似这样,但是我只是想让他显示一条
 <?php 
                                               $sql="select  *  from p_video order by id DESC limit 1 ";
                                                  $query=$db->query($sql);
                                                   while($row2=$db->fetch_array($query)){
                                              ?>
<div class="newspicleft"><a href="video_show.php?id=<?php echo $row2[id]?>">

解决方案 »

  1.   

    "video_show.php?id=<?php echo $row2['id']; ?>"
    不太明白你的问题,order by id DESC limit 1 已经就是取最新一条了
      

  2.   

    查询每个部门工资前两名的通用sqlselect deptno, ename, sal   
    from emp e1  
    where   
       (select count(1)  
       from emp e2  
       where e2.deptno=e1.deptno and e2.ename!=e1.ename and e2.sal>e1.sal)  
       <2  
    order by deptno, sal desc;  
      

  3.   

    只有一条记录就不需要while循环了。
      

  4.   

    要显示id和内容,while后,直接
    <div class="newspicleft"><a href="video_show.php?id=<?=$row2['id']?>"><?=$row2['content']?></a></div>
    limit 1 就只有一行记录啊。