Jump to content
MakeWebGames

Top 5 Players in Citys


Recommended Posts

needing some help here... the code below isnt even close seeing how i cant organize by city...

something like WHERE $user_class->city ... im lost as you cant tell lol help me

 

[mysql]

<?php

$result = mysql_query("SELECT * FROM `grpgusers` WHERE `$user_class->city=` ORDER BY `exp` DESC LIMIT 5");

while($line = mysql_fetch_array($result, MYSQL_ASSOC)) {

$user_online = new User($line['id']);

echo "<div>".$user_online->id.".)".$user_online->formattedname."</div>";

}

?>

 

[/mysql]

Link to comment
Share on other sites

I've not had GRPG but with basic mysql i'd so something like

    $query = mysql_query('SELECT `id`, `name` FROM `users` u LEFT JOIN `city` c ON c.`city` = u.`location` ORDER BY `column` DESC LIMIT 5')
  while ( $fetched = mysql_fetch_object($query) ) {
echo '
<div>
'.$fetched->name.' ('.$fetched->id.')
</div>
';
  }
Link to comment
Share on other sites

[mysql]

<?php

$result = mysql_query("SELECT * FROM `grpgusers` WHERE `city = $user_class->city` ORDER BY `exp` DESC LIMIT 5");

while($line = mysql_fetch_array($result, MYSQL_ASSOC)) {

$user_online = new User($line['id']);

echo "<div>".$user_online->id.".)".$user_online->formattedname."</div>";

}

?>

[/mysql]

 

i dont understand why this wont work :(

Link to comment
Share on other sites

<?php

include (DIRNAME(__FILE__) . '/header.php');

 

echo '<tr><td class="contenthead">List Of All Complaints</td></tr>

<tr><td class="contentcontent">';

 

$result = mysql_query("SELECT * FROM `grpgusers` WHERE ".$user_class->city." ORDER BY `exp` DESC LIMIT 5");

while($line = mysql_fetch_array($result, MYSQL_ASSOC)) {

echo "<div>".mysql_real_escape_string(strip_tags($line['id'])).". ".mysql_real_escape_string(strip_tags($line['username']))."</div>";

}

include (DIRNAME(__FILE__) . '/footer.php');

?>

this only works for the EXP not stat's.

Regards Linton.

PS: Sorry I forgot about making this for you!

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...