Badges not displaying

Status
Not open for further replies.

Detox

Member
Jul 24, 2010
365
24
Hey DevBest,

I'm having issue with the badges not being display on the home page

Images:

Screen_Shot_2016_11_04_at_2_51_10_PM.png


Screen_Shot_2016_11_04_at_2_51_19_PM.png


Code:

PHP:
<?php
$badges = mysql_query("SELECT * FROM user_badges WHERE user_id = '".$_SESSION['user']['id']."' ORDER BY id DESC");
if(mysql_num_rows($badges) < 7) {
echo 'You have no badges';
}
while($badge = mysql_fetch_assoc($badges)) {
echo '<div class="hastip badge" title="'.$badge['badge_id'].'">
<img class="hastip" src="images/'.$badge['badge_id'].'.gif" title="'.$badge['badge_id'].'"/>
 </div>';
}
?>
 

Markshall

Русский Стандарт
Contributor
Dec 18, 2010
2,638
2,393
You're limiting it to 7 badges. So if the user has less than 7 badges it'll display 'You have no badges.' From your database picture I can only see 1 badge? Either add more badges or remove the limitation.

Ps: why are you using mysql_*
 
Status
Not open for further replies.

Users who are viewing this thread

Top