Jump to content

Table With Fetch


Cloud9247

Recommended Posts

I have been developing my graphics site lately, and I have run into a problem. Currently I am setting up a 100x100 avatars page, and I am using mysql_fetch_array. I want it to have in each row of avatars, 4 avatars per row. and I am currently using tables for this, so can someone help me get it to where every 4 rows it inserts a '<tr>' and '</tr>', so I could get more rows?
Link to comment
Share on other sites

[code]
<?php
echo $top1.'Avatars'.$top2.$body1;
echo '<table id= "avatars"><tr>';
$i= 0;
        $sqll= "SELECT userid, id, clicks, username, submitted, name, credits, comments, series, imgurl, active FROM avatars WHERE active='1' ORDER BY `id` DESC LIMIT $from, $max_results"; // LIMIT $from, $max_results
$rss= mysql_query( $sqll, $connection );
while($row= mysql_fetch_array( $rss )) {


$dwn= "return false;";


echo '<td id= "avi"><a href= "http://hayalkarga.com/designs.php?viewavatar='.$row['id'].'"><img src= "'.$row['imgurl'].'" id= "graphic" alt= "'.$row['name'].'" oncontextmenu="return false"></a></td>';

  if ($i == 3) {
      echo "</tr><tr>";
      $i = 0;
  }
$i++;
}
echo '</tr></table>';
echo $body2.$foot1.$foot2;
[/code]

comes out as: http://hayalkarga.com/designs.php?designs=avatars

It prints out 4 on the first row, but only 3 on the others. Can someone help me fix this?
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.