Jump to content
MakeWebGames

Recommended Posts

Posted

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.

Posted

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

Posted

Re: Top 5 Table for Register/Login

If you are putting it in something that's already printing, make it look like this

 

You're unable to view this code.

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

 

That way the print that's already happening will continue to occurr

Posted

Re: Top 5 Table for Register/Login

 

what is the code for v2?

It makes no difference, it only checks the users and userstats tables, so it works on both... :)

Posted

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

  • 4 weeks later...
Posted

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'; }

Posted

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.

Posted

Re: Top 5 Table for Register/Login

Well it would slow down your register and login by far exspecialy big games like mine and iso's and those who have 1500+ i am almost about to hit 2k users and imagine if i add that? it will be a stress load to the server :|

Guest Anonymous
Posted

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.

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