while loop problem

Started on the old forum in July 2012 · view the original in the archive · old links redirect here

1 reply · 429 views · started 14 years ago · 1 min read

2 participants
shushant Developer · 207 posts #1

here is my 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

arnage Lead · 811 posts #2

Try this way.

     $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 % 4 == 0){
     echo '<div class="horizontal_dotted_seperator"></div>';
     }
        
     }
<!DOCTYPE html PUBLIC "-//***WAPFORUM**.**RS***

Sign in to reply.

Similar topics

Keyboard shortcuts

g f
Go to forums
g h
Go to your feed
g m
Go to messages
r
Reply (in a topic)
/
Search
j
Next post
k
Previous post
?
This list
Ctrl/⌘ + Enter
Send what you are writing
Ctrl/⌘ + B / I
Bold / italic while writing
Esc
Close