• Unfortunately, we have experienced significant hard drive damage that requires urgent maintenance and rebuilding. The forum will be a state of read only until we install our new drives and rebuild all the configurations needed. Please follow our Facebook page for updates, we will be back up shortly! (The forum could go offline at any given time due to the nature of the failed drives whilst awaiting the upgrades.) When you see an Incapsula error, you know we are in the process of migration.

Fame for maplebit rankings

Experienced Elementalist
Joined
Mar 28, 2015
Messages
237
Reaction score
69
Eh, not sure this is even release worthy, but I'm bored so here we are.

Add <th>Fame</th> where you'd like to place the column for fame in your rankings.php

Beneath
Code:
while($row = $result->fetch_assoc()) {
                $ranking++;
                $name = $row['name'];
add
Code:
     $fame = $row['fame'];           
                if ($fame > 0) $color = '#008000';
                if ($fame < 0) $color = '#FF0000';
                if ($fame == 0) $color = '#000';
Then add
Code:
<td><b><span style=\"color: $color;\">".$row['fame']."</span></b></td>
In corresponding order to where you placed the fame column.
This will display the amount of fame the character has, as well as switching colors of the fame integer (negative=red, 0=black positive=green).

Preview:
3lYYRAO - Fame for maplebit rankings - RaGEZONE Forums
 

Attachments

You must be registered for see attachments list
Last edited:
Newbie Spellweaver
Joined
Apr 11, 2015
Messages
24
Reaction score
2
this is nice, but maybe change the color from neutral from black to yellow/gold since (imo) it looks better
 
Experienced Elementalist
Joined
Jul 8, 2014
Messages
263
Reaction score
33
Wonderful addition in my opinion! In fact learning this will allow me (or anyone) to pull any info from the database and display it on the rankings. Sure there's only so much that's worth displaying (what else besides fame, omok wins?), but this is a cool addition.

I'm am inexperienced in PHP, and couldn't seem to figure out how the "fame" index is defined.

Cygnus - Fame for maplebit rankings - RaGEZONE Forums


Instead of asking, I actually read the code. Big shock, right? I needed to do two simple things:

PHP:
$result2 = $mysqli->query("SELECT c.name , c.job , c.level, c.reborn, c.fame

and:

PHP:
$result = $mysqli->query("SELECT c.name , c.job, c.level, c.reborn, c.fame,

What's different? If you look at your file, you will notice c.fame is not indexed for the msqli.

I added it in the order the table displays the results, be sure to accommodate for being a rebirth server or not. Adding this removed the errors, and taught me that I copied and pasted the authors code into the wrong location (the first time around).

Cygnus - Fame for maplebit rankings - RaGEZONE Forums


Thanks for the contribution!
 
Experienced Elementalist
Joined
Mar 28, 2015
Messages
237
Reaction score
69
Wonderful addition in my opinion! In fact learning this will allow me (or anyone) to pull any info from the database and display it on the rankings. Sure there's only so much that's worth displaying (what else besides fame, omok wins?), but this is a cool addition.

I'm am inexperienced in PHP, and couldn't seem to figure out how the "fame" index is defined.
Instead of asking, I actually read the code. Big shock, right? I needed to do two simple things:

PHP:
$result2 = $mysqli->query("SELECT c.name , c.job , c.level, c.reborn, c.fame

and:

PHP:
$result = $mysqli->query("SELECT c.name , c.job, c.level, c.reborn, c.fame,

What's different? If you look at your file, you will notice c.fame is not indexed for the msqli.

I added it in the order the table displays the results, be sure to accommodate for being a rebirth server or not. Adding this removed the errors, and taught me that I copied and pasted the authors code into the wrong location (the first time around).
Oh, sorry about that. I forgot to check whether or not the c.fame was there at default (i thought it might be since there was a lot of other, unused queries.). I'll check again and add any missing parts! Glad you like it :)
Regards, Cygnus
 
Experienced Elementalist
Joined
Jul 8, 2014
Messages
263
Reaction score
33
Oh, sorry about that. I forgot to check whether or not the c.fame was there at default (i thought it might be since there was a lot of other, unused queries.). I'll check again and add any missing parts! Glad you like it :)
Regards, Cygnus

No need to apologize, or I might have just copy/pasted everything without learning a thing (just kidding, I do like to learn). I did happen to be working on my rankings page, and you might like this little addition: Post # 5

http://forum.ragezone.com/f690/rankings-script-maplebit-website-character-988392/#post8394910
 
Back
Top