PHP looping problem?
        Posted  
        
            by NeVeR
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by NeVeR
        
        
        
        Published on 2010-05-08T12:44:24Z
        Indexed on 
            2010/05/08
            12:48 UTC
        
        
        Read the original article
        Hit count: 163
        
php
I'm trying to display the first row in one color and the second row in another color but my code displays the result twice in both colors for example lets say I have 5 results my code will double the results by displaying 10 results. How can I fix this problem?
Here is the php code.
while ($row = mysqli_fetch_assoc($dbc)) {
    //first row
    echo '<h3 class="title"><a href="#" title="">' . $row['title'] .'</a></h3>';
    echo '<div class="summary"><a href="#" title="">' . substr($row['content'],0,255) . '</a></div>';
    //second row
    echo '<h3 class="title-2"><a href="#" title="">' . $row['title'] .'</a></h3>';
    echo '<div class="summary-2"><a href="#" title="">' . substr($row['content'],0,255) . '</a></div>';
}
© Stack Overflow or respective owner