Welcome to WebmasterWorld Guest from 54.166.189.88

Forum Moderators: coopster & jatar k

Message Too Old, No Replies

php - making output be in two rows

     
1:10 am on Mar 14, 2010 (gmt 0)

Junior Member

5+ Year Member

joined:Apr 18, 2008
posts: 67
votes: 0


Hey guys, I am trying output my registered members pictures in two columns on my web page, but so far it only outputs in a single column. Any help?

Here's my code:

//$result holds all the registered users
$sql="SELECT username FROM registeredusers ORDER BY id";
$result=mysql_query($sql);


//while statement to keep outputting results, but it only outputs in 1 single column?
while($info=mysql_fetch_array($result))
{
$username = $info['username'];
$avatarPath = $dbConn->getDefaultAvatar($username);//gets path of user's picture

if($avatarPath == null){//if user has no picture, then display nothing
$myProfilePic2 = "<img src='".$avatarPath."' height=70px width=70px alt=UserPic />";
}else{
$myProfilePic2 = "<img src='".$avatarPath."' height=70px width=70px alt=UserPic />";
}

$this->data .='
<table id="userPost" width="300px">
<tr>

<td width="300px">
<td width="100px"><a class="mainPage" href="profile.php?username='.$username.' ">'.$myProfilePic2.'</a></td>
<td width="200px">
<table width="200px" height="10px">
<tr class="userPictures"><td width="25px"></td></td><td>'.$username.'</td></tr>
<tr class="userPictures"><td width="25px"></td><td>city</td></tr>
<tr class="userPictures"><td width="25px"></td><td>stats</td></tr>
</table>
</td>
</td>

</tr>
</table><div id="spacerH5"></div>
';
}


What have I done wrong? OR what have I NOT DONE to get this to output into two columns (say a 2 x n row table, where n depends on the number of registered users).

Thanks for any and all help.
4:38 am on Mar 15, 2010 (gmt 0)

Junior Member

10+ Year Member

joined:July 30, 2004
posts:81
votes: 0


In the first place, I only see ONE attempt to display an image.

In the second place, the HTML for your table cells is structured like this:

<td width="300px">
<td width="100px"></td>
<td width="200px">
</td>
</td>

which is wrong, because the "300px" cell is trying to contain two other cells within it.
 

Join The Conversation

Moderators and Top Contributors

Hot Threads This Week

Featured Threads

Free SEO Tools

Hire Expert Members