Create a new table called 'ranks' with 3 fields, rank (varchar), ranklevel (smallint), and race (varchar), however in all of halls tutorials he has used class insted of race, so for this I will just call class for now!
Create a new field in players table called rank (smallint)
Create query (did this in my statpanel.php as this is the only place its used and easier than adding it to each individual page).
Code: Select all
$ranklevel=$playerinfo3['rank'];
$rankclass=$playerinfo3['class'];
$rankinfo="SELECT * from ranks WHERE ranklevel='$ranklevel' AND race='$rankclass'";
$rankinfo2=mysql_query($rankinfo) or die("could not get rank!");
$rankinfo3=mysql_fetch_array($rankinfo2);
Code: Select all
echo "" . $rankinfo3['rank'] . "";
changed levelup.php code that was in my new rankup.php code to this
Code: Select all
<?php
$rankexperneeded = ($playerinfo3['rank'] * 250) * $playerinfo3['rank'];
if ($playerinfo3['exper'] >= $rankexperneeded)
{
Code: Select all
echo "<u>Choose what you would like to level up in</u><br><br>";
echo "<A href='rankup2.php?stat=att'>Attack</a><br>";
echo "<A href='rankup2.php?stat=def'>Defense</a><br>";
echo "<A href='rankup2.php?stat=hp'>Hit Points</a><br>";
echo "<A href='rankup2.php?stat=tp'>Tech Points</a><br>";
Code: Select all
else
{
echo "Your exp. is only " . $playerinfo3['exper'] . "<br>" . $rankexperneeded . " exp. is needed before your next promotion. <br><br> <A href='index.php'>Go Back</a>";
}
I then inserted some data into my ranks field. Name of the rank, the rank level (thought about having this as an autoinc, but choose against it because ...) and the name of the class ... which is matched to the name of class in the players tables, this allows for unique promotion title for each class seperately.
Heres a screen of my ranks table so you can see what I mean: