Forums

RS-Linkify Thread is sticky

Quick find code: 261-262-33-65181208

Indecent Act

Indecent Act

Posts: 7,456 Rune Posts by user Forum Profile RuneMetrics Profile
Meredith wtf said :
How did you design your hiscores database?

I'm torn between (username, attack_xp, attack_rank, agility_xp, etc) and (username, skill_name, rank, xp)

I think I'm leaning toward the 2nd one


name, cmblvl, overalrnk, overallLvl, overallxp, attrnk, attlvl, attxp....etc ...timestamp.

I find this easier for readability having all the user's stats across a single row. I like it that I ask for a single row and I have all the player's stats.

In all honesty I consider you a far better judge than me on database handling and sql. This has been my first attempt at a large DB (currently over 1.2 million player stats stored) and so far it's been hassle free, but I have no previous experience to compare to.

I'm not confident enough to recommend one layout over the other, all I can say is what works for me.

Edit: Please lemme know what way you go, and how it goes. I'm sure no matter what you do it will work out well :)

07-Feb-2014 22:43:00 - Last edited on 07-Feb-2014 22:47:15 by Indecent Act

Meredith wtf

Meredith wtf

Posts: 4,160 Adamant Posts by user Forum Profile RuneMetrics Profile
I feel like the 2nd option would lead to more concise code, but I think it's a little slower, cuz you'd have to run multiple queries every time you update it.

I don't like the idea of having to be like

echo "<tr><td>$stats["attack_lvl"]</td><td>$stats["attack_xp"]</td><td>$stats["attack_rank"]</td></tr>
<tr><td>$stats["agility_lvl"]</td><td>$stats["agility_xp"]</td><td>$stats["agility_rank"]</td></tr>"

I don't think $stats["{$skill}_lvl"] is valid php, so you'd have to hard code a lot

It'd be a lot nicer to be like

foreach($stats as $stat){
$table .= "<tr><td>$stat["level"]</td><td>$stat["xp"]</td><td>$stat["rank"]</td></tr>";
}

I think that's what I'm gonna go with. Won't have time to work on it for a few days, though :/

07-Feb-2014 23:06:25

Indecent Act

Indecent Act

Posts: 7,456 Rune Posts by user Forum Profile RuneMetrics Profile
Here you go :)

­­­­Hardstylez­­ http://www.indecentcode.com/rslinkify_images/10337.png­­10337­­­­

@Lekerashi, would you like a transparent background with yours?

edit:
Did it with transparency I can change it if you like.

­­­­Lekerashi­­ http://www.indecentcode.com/rslinkify_images/10338.png­­10338­­­­

09-Feb-2014 03:42:45 - Last edited on 09-Feb-2014 03:49:36 by Indecent Act

Quick find code: 261-262-33-65181208 Back to Top