homepage Welcome to WebmasterWorld Guest from
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Pubcon Platinum Sponsor 2014
Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
Forum Library, Charter, Moderators: coopster & jatar k

PHP Server Side Scripting Forum

php - making output be in two rows

5+ Year Member

Msg#: 4097187 posted 1:10 am on Mar 14, 2010 (gmt 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";

//while statement to keep outputting results, but it only outputs in 1 single column?
$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 />";
$myProfilePic2 = "<img src='".$avatarPath."' height=70px width=70px alt=UserPic />";

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

<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><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.



10+ Year Member

Msg#: 4097187 posted 4:38 am on Mar 15, 2010 (gmt 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">

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

Global Options:
 top home search open messages active posts  

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved