adamlacombe Posted May 31, 2010 Share Posted May 31, 2010 I am trying to make a members page listing all members. I want it to display side by side ya know not below eachother. So I am a little confused on what I should do.. I am thinking I should be using a for_each() somehow but no clue.. This is what I got for now: <?php $title="Members"; $metakeywords="members, cool, people, $sitename"; $metadescription="Members of $sitename"; include ('header.php'); echo "<div class='header'>Members</div><table width='100%' border='1px' class='content'><tr>"; $getpage=clean_up($_GET['page']); $getpage = abs((int) ($getpage)); $total = mysql_result(mysql_query("SELECT COUNT(*) FROM users WHERE activation_key='0'"), 0); $page_count = ceil($total / $resultspp); $page = 1; if (isset($getpage) && $getpage >= 1 && $getpage <= $page_count) { $page = (int)$getpage; } $skip = ($page - 1) * $resultspp; $result = mysql_query("SELECT * FROM users WHERE activation_key='0' LIMIT $skip, $resultspp"); while ($row = mysql_fetch_array($result)) { $uid=clean_up($row['id']); $avatar=clean_up($row[avatar]); $myspace=clean_up($row[myspace]); $aim=clean_up($row[aim]); $yim=clean_up($row[yim]); $status=clean_up($row[statusmsg]); $mood=clean_up($row[mood]); $tstatus=clean_up($row['status']); $firstname=clean_up($row['first']); $lastname=clean_up($row['last']); echo "<td>"; if($tstatus >= time()-15*60){ echo"<img src='templates/$template/sources/images/status_online.png' title='online' /> "; }else{ echo"<img src='templates/$template/sources/images/status_offline.png' title='offline' /> "; } echo"<a href='index.php?action=profile&id=$uid' title='$firstname $lastname'>$firstname $lastname<br /> <img src='pic.php?w=100&h=100&constrain=1&img=$domain/avatars/$avatar' /></a><br>"; if($_SESSION['id']){ echo "<a href='index.php?action=messages&sa=send&to=$uid'><img src='templates/$template/sources/images/mail.gif' title='Personal Message' /></a> "; } if($myspace){ echo "<a href='http://myspace.com/$myspace'><img src='templates/$template/sources/images/myspace.gif' title='$myspace' /></a> "; } if($aim){ echo "<a href='aim:goim?screenname=$aim&message=Hi.+Are+you+there?'><img src='templates/$template/sources/images/aim.gif' title='$aim' /></a> "; } if($yim){ echo "<a href='http://edit.yahoo.com/config/send_webmesg?.target=$yim'><img src='templates/$template/sources/images/yim.gif' title='$yim' /></a> "; } if($status){ echo "<br /><b>Status:</b> $status."; } if($mood){ echo "<br /><b>Mood:</b> $mood <img src='http://x.myspacecdn.com/images/blog/moods/iBrads/$mood.gif' />"; } echo"</td>"; } echo "</tr></table>"; echo "<div class='content'><center>"; if($getpage == 0 || $getpage == 1){}else{ $plink = $getpage - 1; echo " <a href='index.php?action=members&page=$plink'>Previous</a> "; } echo "<select id='ddp' onchange='document.location=(ddp.value)'> <option value=''>Page #</option>"; for ($i = 1; $i <= $page_count; ++$i){ echo ' <option value="index.php?action=members&page=' . $i . '">' . $i . '</option>'; } echo "</select>"; if($getpage == $page_count){}else{ if($page_count>1){ if($getpage == 0){ echo " <a href='index.php?action=members&page=2'>Next</a> "; }else{ $nlink = $getpage + 1; echo " <a href='index.php?action=members&page=$nlink'>Next</a> "; } } } echo "</center></div>"; ?> </td></tr></table> </td> <td VALIGN="TOP" width="200"><table width="200"><tr> <td width="200" VALIGN="TOP"> SIDEBAR! </td></tr></table> </td> </tr> <br> </table></center> <?php include ('footer.php'); ?> Problem with what I have now is that it will keep lining the members up side by side but never will it drop down to the next line. So basically I need 5 members to show per row is what I am trying to say Thanks Link to comment https://forums.phpfreaks.com/topic/203452-help-with-displaying-data/ Share on other sites More sharing options...
adamlacombe Posted May 31, 2010 Author Share Posted May 31, 2010 so basically the code now is: <?php echo "<div class='header'>Members</div><table width='100%' border='1px' class='content'><tr>"; $result = mysql_query("SELECT * FROM users WHERE activation_key='0' LIMIT 30"); while ($row = mysql_fetch_array($result)) { $id=clean_up($row['id']); $first=clean_up($row['first']); $last=clean_up($row['last']); echo "<td>"; echo "user stuff"; echo"</td>"; } echo "</tr></table>"; ?> </td></tr></table> </td> <td VALIGN="TOP" width="200"><table width="200"><tr> <td width="200" VALIGN="TOP"> SIDEBAR! </td></tr></table> </td> </tr> <br> </table></center> Link to comment https://forums.phpfreaks.com/topic/203452-help-with-displaying-data/#findComment-1065852 Share on other sites More sharing options...
riwan Posted May 31, 2010 Share Posted May 31, 2010 read this first http://www.phpfreaks.com/forums/index.php/topic,299600.0.html Link to comment https://forums.phpfreaks.com/topic/203452-help-with-displaying-data/#findComment-1065859 Share on other sites More sharing options...
adamlacombe Posted May 31, 2010 Author Share Posted May 31, 2010 Thank you very very much! Works like a charm. That will come in very handy! Link to comment https://forums.phpfreaks.com/topic/203452-help-with-displaying-data/#findComment-1065867 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.