doulian7252 2014-10-10 02:06
浏览 9
已采纳

幻灯片只显示一个文件

hi everyone i try to make slideshow with php code and jquery and the code like here

 <?php
                  $terkini=mysql_query("SELECT * FROM berita WHERE headline='Y' ORDER BY id_berita DESC LIMIT 5");
                  $no=1;
                  while($t=mysql_fetch_array($terkini)){      

                  $isi_berita = strip_tags($t['isi_berita']); 
                  $isi = substr($isi_berita,0,150); 
                  $isi = substr($isi_berita,0,strrpos($isi," ")); 

                  echo "<div class='camera_wrap camera_azure_skin' id='cameraslide'>
                                        <div class='camera-slide-wrapper span8' data-src='foto_berita/$t[gambar]'>
                                            <div class='camera_caption fadeFromLeft'>
                                                <a href='berita-$t[judul_seo].html'>$t[judul]</a>
                                            </div>
                                        </div>
                                    </div>";

                  $no++;  }
                  ?>

but as i see its only show 1 news slide even i call it with 5 news from database thanks.

  • 写回答

1条回答 默认 最新

  • douduiwei2831 2014-10-10 02:42
    关注

    You are seeing only one newsslide as I guess you are updating all the data in the same div... so the data is getting overriden. Guess, the code should be something like this...

    <?php
    
    
                  echo "<div class='camera_wrap camera_azure_skin' id='cameraslide".$no."'>
                                        <div class='camera-slide-wrapper span8' data-src='foto_berita/$t[gambar]'>
                                            <div class='camera_caption fadeFromLeft'>
                                                <a href='berita-$t[judul_seo].html'>$t[judul]</a>
                                            </div>
                                        </div>
                                    </div>";
    
                  $no++;  }
                  ?>
    

    i.e. guess you forgot to append the $no variable to the div id....

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 Oracle触发器记录修改前后的字段值
  • ¥100 为什么这个恒流源电路不能恒流?
  • ¥15 有偿求跨组件数据流路径图
  • ¥15 写一个方法checkPerson,入参实体类Person,出参布尔值
  • ¥15 我想咨询一下路面纹理三维点云数据处理的一些问题,上传的坐标文件里是怎么对无序点进行编号的,以及xy坐标在处理的时候是进行整体模型分片处理的吗
  • ¥15 CSAPPattacklab
  • ¥15 一直显示正在等待HID—ISP
  • ¥15 Python turtle 画图
  • ¥15 stm32开发clion时遇到的编译问题
  • ¥15 lna设计 源简并电感型共源放大器