Grabbing Looks

Status
Not open for further replies.

Muffmuncher

Member
Jan 11, 2012
61
12
Atm, the following shows in order the users who have the most amount of credits.
PHP:
<?PHP
                                            $sql = mysql_query("SELECT * FROM users WHERE rank < 4 ORDER BY credits DESC LIMIT 10");
                                         
                                            while($a = mysql_fetch_array($sql)) {
                                                echo "<tr>
                                              <td class='tablerow1' align='center'><hr />".filter($a['username'])."</a></td>
                                              <td class='tablerow2' align='center'><hr />".Filter($a['credits'])."</td>
 
                                            </tr>";
                                                } ?>

How do I edit it so as it also shows their looks?
Referring to:
PHP:
<?php
                            $GetRanks = mysql_query("SELECT id,name FROM ranks WHERE id >= 4 ORDER BY id DESC");
                            while($Ranks = mysql_fetch_assoc($GetRanks))
                            {
                                echo "<div class=\"habblet-container \"><div class=\"cbb clearfix blue \"><h2 class=\"title\">{$Ranks['name']}s</h2><div style=\"padding:5px\"><p>";
                                $GetUsers = mysql_query("SELECT username,motto,rank,last_online,online,look FROM users WHERE rank = {$Ranks['id']}");
                                while($Users = mysql_fetch_assoc($GetUsers))
                                {
                                    if($Users['online'] == 1){ $OnlineStatus = "<font color=\"darkgreen\"><b>Online</b></font>"; } else { $OnlineStatus = "<font color=\"darkred\"><b>Offline</b></font>"; }
                                    echo "<img style=\"position:absolute;\" src=\"http://www.habbo.com/habbo-imaging/avatarimage?figure={$Users['look']}&action=wav&direction=2&head_direction=3&gesture=srp&size=l\">"
                                        ."<p style=\"margin-left:80px;margin-top:20px;\">Username: <strong>{$Users['username']}</strong><br>Motto: <strong>{$Users['motto']}</strong><br><small>Last Online: ". date("D, d F Y H:i (P)", $Users['last_online']) ."</small></p>"
                                        ."<p style=\"float:right;margin-top:-30px;margin-right:5px;\">{$OnlineStatus}</p><br><br><br>";
                                }
                                echo "</div></div></div>";
                            }
                        ?>

I tried this, but I'm just not good at this:
PHP:
<?PHP
                                            $sql = mysql_query("SELECT * FROM users WHERE rank < 4 ORDER BY credits DESC LIMIT 10");
                                            while($sql = mysql_fetch_assoc($sql))
                                            {
                                                while($a = mysql_fetch_array($sql))
                                                {
                                                    echo "<img style=\"position:absolute;\" src=\"http://www.habbo.com/habbo-imaging/avatarimage?figure={$Users['look']}&action=wav&direction=2&head_direction=3&gesture=srp&size=l\">"
                                                    .echo "<tr>
                                                    <td class='tablerow1' align='center'><hr />".filter($a['username'])."</a></td>
                                                    <td class='tablerow2' align='center'><hr />".Filter($a['credits'])."</td>
                                                    </tr>";
                                                }
                                            } 
                                            ?>

Any help? Thanks in advance.
 

Nike

#MGK
Jun 9, 2012
545
107
I am not very experience with PHP. But, you could go to the me page, since it shows the avatar their and copy it and edit to where it is on the other page? Just a thought I am a noob at PHP.
 

TheJb

New Member
Jun 8, 2011
10
2
Did try your code, to see what needed changing, and it was the {$Users['look']} needed changing to {$a['look']}
however I couldn't get your code to display anything within my CMS, so I have rewritten your code to something that displays the avatar and the information you wanted.

Might want to check if it goes over 10 users, but I don't think it will do.

PHP:
<?PHP
 
$sql = "SELECT * FROM `users` WHERE `rank` < '4' ORDER BY `credits` DESC LIMIT 10";
    $result = mysql_query($sql);
                 
if(mysql_num_rows($result))
{
    while($row = mysql_fetch_array($result))
    {
    echo "<img style=\"position:absolute;\" src=\"http://www.habbo.com/habbo-imaging/avatarimage?figure={$row['look']}&action=wav&direction=2&head_direction=3&gesture=srp&size=l\">";
    echo "<tr>
    <td class='tablerow1' align='center'><hr />".filter($row['username'])."</a></td>
    <td class='tablerow2' align='center'><hr />".Filter($row['credits'])."</td>
    </tr>";
    }
}
             
?>
 

Muffmuncher

Member
Jan 11, 2012
61
12
Did try your code, to see what needed changing, and it was the {$Users['look']} needed changing to {$a['look']}
however I couldn't get your code to display anything within my CMS, so I have rewritten your code to something that displays the avatar and the information you wanted.

Might want to check if it goes over 10 users, but I don't think it will do.

PHP:
<?PHP
 
$sql = "SELECT * FROM `users` WHERE `rank` < '4' ORDER BY `credits` DESC LIMIT 10";
    $result = mysql_query($sql);
               
if(mysql_num_rows($result))
{
    while($row = mysql_fetch_array($result))
    {
    echo "<img style=\"position:absolute;\" src=\"http://www.habbo.com/habbo-imaging/avatarimage?figure={$row['look']}&action=wav&direction=2&head_direction=3&gesture=srp&size=l\">";
    echo "<tr>
    <td class='tablerow1' align='center'><hr />".filter($row['username'])."</a></td>
    <td class='tablerow2' align='center'><hr />".Filter($row['credits'])."</td>
    </tr>";
    }
}
           
?>
Uh yes, you'll have to change .com to .fr or something else for it to work, Habbo might have disabled hot-linking; it worked for me with habbo.fr. I appreciate that you took your time to look into the code for me, but here's the thing:
You must be registered for see images attach

Can you see what's the problem?
 

TheJb

New Member
Jun 8, 2011
10
2
Uh yes, you'll have to change .com to .fr or something else for it to work, Habbo might have disabled hot-linking; it worked for me with habbo.fr. I appreciate that you took your time to look into the code for me, but here's the thing:
You must be registered for see images attach

Can you see what's the problem?


Yes, its the position tag in the code for images, maybe try this code (using align="left"):
PHP:
<?PHP
 
$sql = "SELECT * FROM `users` WHERE `rank` < '4' ORDER BY `credits` DESC LIMIT 10";
    $result = mysql_query($sql);
   
if(mysql_num_rows($result))
{
    while($row = mysql_fetch_array($result))
    {
    echo "<img src=\"http://www.habbo.com/habbo-imaging/avatarimage?figure={$row['look']}&action=wav&direction=2&head_direction=3&gesture=srp&size=l\" align=\"left\" width=\"64px\" height=\"110px\">";
    echo "<tr>
    <td class='tablerow1' align='center'><hr />".filter($row['username'])."</a></td>
    <td class='tablerow2' align='center'><hr />".filter($row['credits'])."</td>
    </tr>";
    }
}
 
?>

Or this is another code you could try (Using: style="position:relative;"):
PHP:
<?PHP
 
$sql = "SELECT * FROM `users` WHERE `rank` < '4' ORDER BY `credits` DESC LIMIT 10";
    $result = mysql_query($sql);
   
if(mysql_num_rows($result))
{
    while($row = mysql_fetch_array($result))
    {
    echo "<img src=\"http://www.habbo.com/habbo-imaging/avatarimage?figure={$row['look']}&action=wav&direction=2&head_direction=3&gesture=srp&size=l\" style=\"position:relative;\" width=\"64px\" height=\"110px\">";
    echo "<tr>
    <td class='tablerow1' align='center'><hr />".filter($row['username'])."</a></td>
    <td class='tablerow2' align='center'><hr />".filter($row['credits'])."</td>
    </tr>";
    }
}
 
?>
 

TheJb

New Member
Jun 8, 2011
10
2
All efforts above end up with:
You must be registered for see images attach


I think its because the image is out side the table row, so try this code:

PHP:
<?PHP
 
$sql = "SELECT * FROM `users` WHERE `rank` < '4' ORDER BY `credits` DESC LIMIT 10";
    $result = mysql_query($sql);
 
if(mysql_num_rows($result))
{
    while($row = mysql_fetch_array($result))
    {
    echo "<tr>
    <img src=\"http://www.habbo.com/habbo-imaging/avatarimage?figure={$row['look']}&action=wav&direction=2&head_direction=3&gesture=srp&size=l\" align=\"left\" width=\"64px\" height=\"110px\">
    <td class='tablerow1' align='center'><hr />".filter($row['username'])."</a></td>
    <td class='tablerow2' align='center'><hr />".filter($row['credits'])."</td>
    </tr>";
    }
}
 
?>
 

Muffmuncher

Member
Jan 11, 2012
61
12
I think its because the image is out side the table row, so try this code:

PHP:
<?PHP
 
$sql = "SELECT * FROM `users` WHERE `rank` < '4' ORDER BY `credits` DESC LIMIT 10";
    $result = mysql_query($sql);
 
if(mysql_num_rows($result))
{
    while($row = mysql_fetch_array($result))
    {
    echo "<tr>
    <img src=\"http://www.habbo.com/habbo-imaging/avatarimage?figure={$row['look']}&action=wav&direction=2&head_direction=3&gesture=srp&size=l\" align=\"left\" width=\"64px\" height=\"110px\">
    <td class='tablerow1' align='center'><hr />".filter($row['username'])."</a></td>
    <td class='tablerow2' align='center'><hr />".filter($row['credits'])."</td>
    </tr>";
    }
}
 
?>
I've got it with:
PHP:
<?PHP
 
$sql = "SELECT * FROM `users` WHERE `rank` = '1' ORDER BY `credits` DESC LIMIT 10";
    $result = mysql_query($sql);
 
if(mysql_num_rows($result))
{
    while($row = mysql_fetch_array($result))
    {
    echo "<tr>
    <td class='tablerow1' align='center'><hr />".filter($row['username'])."</a>
    <img src=\"http://www.habbo.fr/habbo-imaging/avatarimage?figure={$row['look']}&action=wav&direction=2&head_direction=3&gesture=srp&size=l\" align=\"left\" width=\"64px\" height=\"110px\"></td>
    <td class='tablerow2' align='center'><hr />".filter($row['credits'])."</td>
    </tr>";
    }
}
 
?>
But now:
You must be registered for see images attach

Hmm.. ?
 

TheJb

New Member
Jun 8, 2011
10
2
I've got it with:
PHP:
<?PHP
 
$sql = "SELECT * FROM `users` WHERE `rank` = '1' ORDER BY `credits` DESC LIMIT 10";
    $result = mysql_query($sql);
 
if(mysql_num_rows($result))
{
    while($row = mysql_fetch_array($result))
    {
    echo "<tr>
    <td class='tablerow1' align='center'><hr />".filter($row['username'])."</a>
    <img src=\"http://www.habbo.fr/habbo-imaging/avatarimage?figure={$row['look']}&action=wav&direction=2&head_direction=3&gesture=srp&size=l\" align=\"left\" width=\"64px\" height=\"110px\"></td>
    <td class='tablerow2' align='center'><hr />".filter($row['credits'])."</td>
    </tr>";
    }
}
 
?>
But now:
You must be registered for see images attach

Hmm.. ?


I'd look at adding a third column (<td>) for the Avatar of the user, and putting the avatar first.
Avatar width is 64px and height 110px, that should then resolve that issue.
 

TheJb

New Member
Jun 8, 2011
10
2
I tried your method, however the end result is still the same. Any ideas other than making it into one column :p

Another possible solution:

PHP:
<?PHP
 
$sql = "SELECT * FROM `users` WHERE `rank` = '1' ORDER BY `credits` DESC LIMIT 10";
    $result = mysql_query($sql);
 
if(mysql_num_rows($result))
{
    while($row = mysql_fetch_array($result))
    {
    echo "<img src=\"http://www.habbo.fr/habbo-imaging/avatarimage?figure={$row['look']}&action=wav&direction=2&head_direction=3&gesture=srp&size=l\" align=\"left\" width=\"64px\" height=\"110px\ style=\"float:left;\">";
    echo "<tr style=\"float: left\">
    <td class='tablerow1' align='center'><hr />".filter($row['username'])."</a></td>
    <td class='tablerow2' align='center'><hr />".filter($row['credits'])."</td>
    </tr>";
    }
}
 
?>


Second Alternative:
PHP:
<?PHP
 
$sql = "SELECT * FROM `users` WHERE `rank` = '1' ORDER BY `credits` DESC LIMIT 10";
    $result = mysql_query($sql);
 
if(mysql_num_rows($result))
{
    while($row = mysql_fetch_array($result))
    {
    echo "<tr>
    <td width=\"64px\" height=\"110px\"><img src=\"http://www.habbo.fr/habbo-imaging/avatarimage?figure={$row['look']}&action=wav&direction=2&head_direction=3&gesture=srp&size=l\" align=\"left\" width=\"64px\" height=\"110px\"></td>
    <td class='tablerow1' align='center'><hr />".filter($row['username'])."</a></td>
    <td class='tablerow2' align='center'><hr />".filter($row['credits'])."</td>
    </tr>";
    }
}
 
?>
 
Status
Not open for further replies.

Users who are viewing this thread

Top