while loop problem

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    while loop problem

    here is my code
    Code:
         $sql = mysql_query("SELECT `id`, `name`, `img`, `phone` FROM `game` ".$catid." LIMIT ".$limit.", 16") or die('Error : On Class :: __CLASS__ on Line :: __LINE__');
      $i = 0;
       while($res = mysql_fetch_array($sql)){
    $name = (strlen($res[1]) > 13) ? substr($res[1],0,10).'...' : $res[1];
    echo '<div class="product_box video">
    
             <div class="image_container"><a href="'.self::$url.'/f/'.$res[0].'/'.seolink($res[1]).'/" rel="download_popbox" class="poplight"><img src="'.self::$url.'/'.$res[2].'" class="tipsy-west"  title="'.$res[1].'"/></a></div>
                <div class="itemtitle"><center><a href="'.self::$url.'/f/'.$res[0].'/'.seolink($res[1]).'/" rel="download_popbox" class="poplight tipsy-west"  title="'.$res[1].'">'.$name.'</a></center></div>
             <a href="'.self::$url.'/f/'.$res[0].'/'.seolink($res[1]).'/" rel="download_popbox" class="poplight"><div class="dwn_btn">Download</div></a>
             
      </div><!--product_box end -->';
        if($i % 4 == 0){
         echo '<div class="horizontal_dotted_seperator"></div>';
         }
            $i++;
         }
    it give me out after missing 3 blocks

    heres my link how it look like
    Free Downloads for Phones & Tablets

    #2
    Try this way.

    PHP Code:
         $sql mysql_query("SELECT `id`, `name`, `img`, `phone` FROM `game` ".$catid." LIMIT ".$limit.", 16") or die('Error : On Class :: __CLASS__ on Line :: __LINE__');
      
    $i 0;
       while(
    $res mysql_fetch_array($sql)){
    $name = (strlen($res[1]) > 13) ? substr($res[1],0,10).'...' $res[1];
    echo 
    '<div class="product_box video">

             <div class="image_container"><a href="'
    .self::$url.'/f/'.$res[0].'/'.seolink($res[1]).'/" rel="download_popbox" class="poplight"><img src="'.self::$url.'/'.$res[2].'" class="tipsy-west"  title="'.$res[1].'"/></a></div>
                <div class="itemtitle"><center><a href="'
    .self::$url.'/f/'.$res[0].'/'.seolink($res[1]).'/" rel="download_popbox" class="poplight tipsy-west"  title="'.$res[1].'">'.$name.'</a></center></div>
             <a href="'
    .self::$url.'/f/'.$res[0].'/'.seolink($res[1]).'/" rel="download_popbox" class="poplight"><div class="dwn_btn">Download</div></a>
             
      </div><!--product_box end -->'
    ;
    $i++; // Here
        
    if($i == 0){
         echo 
    '<div class="horizontal_dotted_seperator"></div>';
         }
            
         } 
    <!DOCTYPE html PUBLIC "-//WAPFORUM.RS

    Comment

    Working...
    X