Monkuar Posted May 3, 2009 Share Posted May 3, 2009 Here is my problem, im calling them from mysql, and letting them pop out like this: Only 1 problem that looks like shit, lol I need a way to make it go: 2 Users show up on each line: kinda confusing? Well i mean like Steve User1 <br> User 2 User 3 <br> User 9 User 10 <br> I want ti nice and beautiful like that, BUT MY PHP Code is not making it do that it's making all there names scattered around like the above image! here is my code //monkuar // Buddy List - monkuar $rank = 'rank'; { $DB->query("SELECT * FROM ibf_contacts c, ibf_members m WHERE member_id='".$member['id']."' AND c.contact_name=m.name ORDER By $rank LIMIT 6"); while($r = $DB->fetch_row()) { //monkaur'd if ($r['desktop']) { $desktop = "<img src='{$r['desktop']}'> "; } else { $desktop = ''; } //monkuar'd if ($r['monkavatar']) { $av = " </a><br><img src='{$r['monkavatar']}' width='54' height='54' alt='' /> "; } else { $av = ''; } if($counter ==1) {$buddylist .= "<td>";} $buddylist .= "<div align=left></a><a href='index.php?showuser={$r['contact_id']}'>{$r['contact_name']}$desktop</a>$av</div>"; if($counter++ >5) {$buddylist .="</td>";$counter=1;} else {$buddylist .= "";} } } if ($buddylist != "") { $this->output = str_replace( "<!-- Monkfriends -->", $buddylist, $this->output ); } // Buddy List //monkuar It output's it with this code: if($counter ==1) {$buddylist .= "<td>";} $buddylist .= "<div align=left></a><a href='index.php?showuser={$r['contact_id']}'>{$r['contact_name']}$desktop</a>$av</div>"; if($counter++ >5) {$buddylist .="</td>";$counter=1;} else {$buddylist .= "";} Can you help me make it so it output's like this: Steve User1 <br> User 2 User 3 <br> User 9 User 10 <br> Thanks PHPFREAKS.COM !! please HEPL <3 [EDIT:] The image under steve just show's that a user has an Avatar srry about that. Quote Link to comment https://forums.phpfreaks.com/topic/156697-solved-counter-problem-with-i-or-something-wont-move-my-users-down-thanks-help/ Share on other sites More sharing options...
Ken2k7 Posted May 3, 2009 Share Posted May 3, 2009 Looks more like a CSS problem? But I think if you take out Steve's avatar it would look better. Your preferred setup doesn't include an image. Quote Link to comment https://forums.phpfreaks.com/topic/156697-solved-counter-problem-with-i-or-something-wont-move-my-users-down-thanks-help/#findComment-825132 Share on other sites More sharing options...
Monkuar Posted May 3, 2009 Author Share Posted May 3, 2009 No it's just the stupid: if($counter ==1) {$buddylist .= "<td>";} $buddylist .= "<div align=left></a><a href='index.php?showuser={$r['contact_id']}'>{$r['contact_name']}$desktop</a>$av</div>"; if($counter++ >5) {$buddylist .="</td>";$counter=1;} else {$buddylist .= "";} it's not a css because it's just inside a basic fieldset tag dont worry about that worry about php plz, lol This is what i want it to look like Thank u sir. : something like this And if they dont have a avatar it doesnt ruin it like my code does. Quote Link to comment https://forums.phpfreaks.com/topic/156697-solved-counter-problem-with-i-or-something-wont-move-my-users-down-thanks-help/#findComment-825134 Share on other sites More sharing options...
Ken2k7 Posted May 3, 2009 Share Posted May 3, 2009 Eh. Someone needs to learn HTML. You have a closed A tag after a DIV when one is not opened. I'm not going to even touch the code you posted because the spacing is far too messy. But, here's what I'm thinking. You'll have to figure out how to put this into your code. You can do something like this: $query = 'YOUR_QUERY'; $result = mysql_query($query) or die(mysql_error()); $output = '<table><tr>'; $count = 0; while ($row = mysql_fetch_assoc($result)) { // 2 in a row if (!empty($count) && $count % 2 == 0) $output .= '</tr><tr>'; $output .= '<td><a href="index.php?showuser=' . $row['contact_id'] . '">' . $row['contact_name'] . '</a><br /><img src="' . $row['desktop'] . '" /></td>'; $count++; } $output .= '</tr></table>'; Quote Link to comment https://forums.phpfreaks.com/topic/156697-solved-counter-problem-with-i-or-something-wont-move-my-users-down-thanks-help/#findComment-825144 Share on other sites More sharing options...
Monkuar Posted May 3, 2009 Author Share Posted May 3, 2009 Thank u sir I got it to work! I love ya! Quote Link to comment https://forums.phpfreaks.com/topic/156697-solved-counter-problem-with-i-or-something-wont-move-my-users-down-thanks-help/#findComment-825153 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.