桌子上有两个条目。但它回音3个条目,但它回音两次其中一个。如果我把它从DESC改成ASC,那么它会重复另一个两次。如果我使用“where id5”,那么它只回显id 6一次。但它是一个动态网站所以。。。我在另一个页面上使用同样的代码,它也能工作。下面是完整的代码:<?php$cek = mysql_query('select id,isim,aciklama,tarih from galeri where dil = '.$dbDil.' order by id desc');while($kaynak = mysql_fetch_assoc($cek)){ $cekG = mysql_query('select resim_url from galeriresim where galeriID = '.$kaynak['id'].' order by id desc'); $galeri .= '<h1 class="sayfaBaslik fl"><span>'.$kaynak['tarih'].'</span> '.$kaynak['isim'].'</h1>'; $galeri .= '<h2 class="sayfaAciklama fl">'.$kaynak['aciklama'].'</h2>'; $galeri .= '<div class="sayfaIcerik" style="width:100%">'; $galeri .= '<div class="galeriH fl swiper-container-'.$kaynak['id'].'">'; $galeri .= '<ul class="fl swiper-wrapper-'.$kaynak['id'].'">'; while($kaynakG = mysql_fetch_assoc($cekG)){ $galeri .= '<li class="swiper-slide-'.$kaynak['id'].'"><img src="'.$yol.'images/galeri/'.$kaynak['id'].'/'.$kaynakG['resim_url'].'" /></li>'; } $galeri .= '</ul></div></div>'; $galeri .='<script>'; $galeri .= 'var mySwiper = new Swiper(\'.swiper-container-'.$kaynak['id'].'\',{'; $galeri .= 'moveStartThreshold : 75,'; $galeri .= 'wrapperClass : "swiper-wrapper-'.$kaynak['id'].'",'; $galeri .= 'slideClass : "swiper-slide-'.$kaynak['id'].'"'; $galeri .= '});'; $galeri .= '</script>'; echo $galeri;}?> (adsbygoogle = window.adsbygoogle || []).push({}); 最佳答案 在main while()循环中执行最后一次回声:while(..) { while(..) { .. } echo ..}应该是while(..) { while(..) { .. }}echo ..因为您在主循环内进行回声,所以您将多次运行该回声,并在构建该回声时将其弹出$galeri。 (adsbygoogle = window.adsbygoogle || []).push({}); 09-19 05:27