PHP / MySQL dönüştürmek 'while' foreach 'deyimleri

0 Cevap php

Bir önceki soruya takiben, shown here, ben 'foreach' ifadeleri içine aşağıdaki kodu değiştirme hakkında gitmek nasıl merak ediyorum? Herhangi bir yardım büyük S., takdir

<div id="banner-wrap">          
    <div id="banner" class="gallery">               
        <ul class="galleryBar">               

                <?php       
                $homeB=mysql_query("select * from istable where fpGallery = '1' ORDER BY RAND() LIMIT 0, 5");
                while($homeG=mysql_fetch_array($homeB)) {   
                $linkcode = $homeG['title'];
                $linkcode = str_replace(" ","",$linkcode);
                echo '
                <li>
                <a href="'.$wwwUrl.'images/'.$homeG['image'].'" rel="'.$linkcode.'">
                <img src="'.$wwwUrl.'images/tn/'.$homeG['image'].'" width="75" height="55" alt="'.$homeG['title'].'" />
                </a>
                </li>                       
                ';
                }                                   

        echo '</ul>';
         echo '</div>'; 

                while($homeGal=mysql_fetch_array($homeB)) {                             
                echo '
                <div id="'.$linkcode.'" class="overlay">
                    <h3>'.$homeGal['title'].'</h3>
                    <h4>'.$homeGal['location'].'</h4>                           
                </div>                                              
                ';
                }

                ?>          
    </div>

0 Cevap