PHP - Getting Respect from a different table

Blasteh

Lord Farquaad
Apr 3, 2013
1,151
513
Hello DB,
So I'm using Plus Emulator, with it's original database from Sledmore.

I have a topstats page, the only problem is, 'respects' are in a different table than the 'users' table, and if I change it, I cannot get the users look.

Here's the image:
You must be registered for see images attach


As you can see, it grabs the look, username and supposed to be grabbing 'respect' from the users table, but there is no such thing as it's in the 'user_stats' table.

Is there anyway I can fetch from both tables without losing the players look and username?
Here's the code:
Code:
<?php
$getCredits = mysql_query("SELECT `look`,`username`,`respect` FROM `users` WHERE `rank` <= '10' ORDER BY `respect` DESC LIMIT 5");
while($creditsStats = mysql_fetch_array($getCredits)) {
echo '
<tr>
<td width="25%"><div id="habbo-plate"><img src="http://www.habbo.com/habbo-imaging/avatarimage?figure=' . $creditsStats['look'] . '&head_direction=3&action=crr=9&gesture=sml&size=m.gif"></div>
<td width="75%"><a href="{url}/home/'.$creditsStats['username'].'"><b>'.$creditsStats['username'].'</b></a><br />'.$creditsStats['respect'].' Respects</td>
</tr>';
}
?>
 
May 1, 2015
467
152
Code:
<tr>
  <?php


  $users_a = mysql_query("SELECT * FROM user_stats ORDER BY respect DESC LIMIT 7 ");
  while($users = mysql_fetch_assoc($users_a)){
  $row = mysql_fetch_assoc($row = mysql_query("SELECT * FROM users WHERE id = '".$users['id']."' LIMIT 10"));
if ($row['rank'] == 13 ) { continue; }
 ?>
<td width="20px"><img src="http://www.habbo.nl/habbo-imaging/avatarimage?figure=<?php echo $avatar; echo $row['look']; ?>&head_direction=3&action=crr=9&gesture=sml&size=m" align="left"></td>
  <td width="195px"><a href="/users"><b><?php echo $row['username']; ?></b></a><br />
  <?php echo number_format($users['respects'], 0); ?> Respects</td>
  </tr>
<?php } ?>
  </table>
     </div>
              </tr>
                            </table>
                            </div>
Tested, it works perfectly.
:up:
 

Users who are viewing this thread

Top