Jump to content
MakeWebGames

Top 5 Table for Register/Login


Vorlen

Recommended Posts

Now, this is in NO WAY an ORIGINAL idea. It was requested, and thus I made a very BASIC version.

If you want a more fancy version, I'm sure you can hire someone, though it'd be a waste... just edit the table, as it's really easy. You can find how to edit a table and font on w3schools anytime.

 

print"

<table width=200><tr><th colspan=2>Top 5 Users</th></tr>

<tr><th>Rank</th> <th>User</th> </tr>";

$q=mysql_query("SELECT u.*,g.*,us.* FROM users u LEFT JOIN userstats us ON u.userid=us.userid LEFT JOIN gangs g ON g.gangID=u.gang WHERE u.user_level = 1 ORDER BY (us.strength+us.agility+us.guard+us.labour+us.IQ) DESC,u.userid ASC LIMIT 5", $c);

$p=0;

while($r=mysql_fetch_array($q))

{

$p++;

print "<tr> <td>$p</td> <td>{$r['gangPREF']} {$r['username']} [{$r['userid']}]</td> </tr>";

}

print "</table>";

The above code goes wherever you want your table. However, make sure that if your table is going somewhere that is ALREADY in a PRINT, please take off the 'print" ' and ' ";' from the beginning and end of this code. Not the ones in the middle.

You're more than welcome to try it out and play around. This is just something to start with.

Link to comment
Share on other sites

Re: Top 5 Table for Register/Login

print" "; =mysql_query("SELECT u.*,g.*,us.* FROM users u LEFT JOIN userstats us ON u.userid=us.userid LEFT JOIN gangs g ON g.gangID=u.gang WHERE u.user_level = 1 ORDER BY (us.strength+us.agility+us.guard+us.labour+us.IQ) DESC,u.userid ASC LIMIT 5", ); =0; while(=mysql_fetch_array()) { ++; print ""; } print "

Top 5 Users

Rank User

[]

i get that on mine

Link to comment
Share on other sites

Re: Top 5 Table for Register/Login

 

nice mod vorlen i may use it

 

Thanks, I might... spiff it up a bit with some styling, but for now, this'll do just fine. Your site CSS in the header should form it to your site's general appearance.

:)

Feel free to enjoy it, and customize it as you see fit

Link to comment
Share on other sites

  • 4 weeks later...

Re: Top 5 Table for Register/Login

_Stoner_ Your Truley Make Me Sick Your So Far Up Vorlen And Cyanide's *** Thats Its Unbelivable Just Because They Code For You Because You Cant Well Here Is A Code I Think You Should Add To Your Game

if($ir['ifyoucantcodeyourself']) { echo 'Why Do It Good bye stoner have a nice poxy life'; }

Link to comment
Share on other sites

Re: Top 5 Table for Register/Login

Prepared for this to slow your game down, depending on game size.

http://criminalexistence.com/ceforums/i ... ic=17644.0

Even though its limited to 5 rather then 20, I'm sure this strain to load on some games...

Also, may be a good idea to select only the columns needed...

 

You're unable to view this code.

Viewing code within this forum requires registration, you can register here for free.

Link to comment
Share on other sites

Guest Anonymous

Re: Top 5 Table for Register/Login

 

You're unable to view this code.

Viewing code within this forum requires registration, you can register here for free.

Hmm, fairly expensive. I checked this using a profiler on a test site with over 12,000 users (randomly generated I hasten to add) and there was a small hit.

By creating indexes on strength, agility and guard, the hit was substantially reduced so it may be workable, but it will depend on how good a machine your database is running on.

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...