Menu
Forums
All threads
Latest threads
New posts
Trending threads
New posts
Search forums
Trending
What's new
New posts
New profile posts
Latest activity
Members
Current visitors
New profile posts
Search profile posts
Upgrades
Log in
Register
What's new
Search
Search
Search titles only
By:
All threads
Latest threads
New posts
Trending threads
New posts
Search forums
Menu
Log in
Register
Navigation
Install the app
Install
More options
Contact us
Close Menu
Forums
Server Development
Habbo Retros
Habbo Q&A
Need help with some Code
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
<blockquote data-quote="Meap" data-source="post: 280247" data-attributes="member: 1553"><p>This is a code to fetch badges for a staff page but the problem I have is it doesnt choose the 5 Im wearing, it chooses 1 or 2 of them and displays that badge, 2 or 3 times so for example, Im wearing 5 different badges but on staff page, badge 1 is showing up twice and badge 2 is showing up 3 times, can anyone help?</p><p>[PHP]$query_badges = Core::$DB->prepare("SELECT * FROM user_badges WHERE user_id = '".$rank_user['id']."' AND badge_slot > 0 ORDER BY badge_slot LIMIT 5")->execute();</p><p> if($query_badges->num_rows == 0)</p><p> { </p><p> self::$staff_containers = self::$staff_containers.'<div><i><ubuntu>'.Template::$language['have_no_badges'].'</ubuntu></i></div>';</p><p> }</p><p></p><p> while($badges = $query_badges->fetch_assoc()){</p><p> self::$staff_containers = self::$staff_containers.'<img style="margin-top: -5px; margin-bottom: 5px; margin-right: 10px; float: left;" src="'.Core::$Config['badge']['url'].$badges['badge_id'].'.gif">';</p><p> }</p><p></p><p> self::$staff_containers = self::$staff_containers.'</p><p> </div></p><p> </p><p> </div></p><p> ';</p><p> }[/PHP]</p></blockquote><p></p>
[QUOTE="Meap, post: 280247, member: 1553"] This is a code to fetch badges for a staff page but the problem I have is it doesnt choose the 5 Im wearing, it chooses 1 or 2 of them and displays that badge, 2 or 3 times so for example, Im wearing 5 different badges but on staff page, badge 1 is showing up twice and badge 2 is showing up 3 times, can anyone help? [PHP]$query_badges = Core::$DB->prepare("SELECT * FROM user_badges WHERE user_id = '".$rank_user['id']."' AND badge_slot > 0 ORDER BY badge_slot LIMIT 5")->execute(); if($query_badges->num_rows == 0) { self::$staff_containers = self::$staff_containers.'<div><i><ubuntu>'.Template::$language['have_no_badges'].'</ubuntu></i></div>'; } while($badges = $query_badges->fetch_assoc()){ self::$staff_containers = self::$staff_containers.'<img style="margin-top: -5px; margin-bottom: 5px; margin-right: 10px; float: left;" src="'.Core::$Config['badge']['url'].$badges['badge_id'].'.gif">'; } self::$staff_containers = self::$staff_containers.' </div> </div> '; }[/PHP] [/QUOTE]
Insert quotes…
Verification
Post reply
Forums
Server Development
Habbo Retros
Habbo Q&A
Need help with some Code
Top