Okay.
I have a database called firemaking for a MMORPG called RuneScape.
This holds the information for the log type, ID, experience, and level required.
What I'm trying to create is a calculator which will tell the user how many logs they require of each time to achieve their goal.
The script will get their current experience by using their username and grabbing the data from http://hiscore.runescape.com/index_lite.ws?player=
After the player= is the players username.
What I want to do is grab the experience, then using that, subtract it from their desired experience or level. Then divide that information by the experience per log (this information is stored in the database).
The problem is, I'm not quite sure the best route to do this as there's a lot of records in the database. I won't just be doing this for firemaking, but for each of the skills in the game.
Any ideas would be welcome.
Also, you can view an example of what I want to create here:
http://www.zybez.net/calcs.php?calc=Firemaking
http://www.runehq.com/guide.php?type=calculator&id=0370
http://www.runehq.com/runekit/skillscalculator_site.php?s=Firemaking
Here's what I have done so far, I'm just not quite sure how to make it work with the database, rather than masses of variables.
<html>
<head>
<title>Experience</title>
</head>
<body>
<form method="post" action="test.php">
Current Exp: <input name="current" type="text" /><br />
Wanted Exp: <input name="wanted" type="text" /><br />
<input type="submit" name="submit"/>
</form>
</body>
</html>
<?php
if (isset($_POST['submit'])) {
$current = $_REQUEST['current'];
$wanted = $_REQUEST['wanted'];
$maple = 45;
$yew = 60;
$magic = 75;
echo <<<HTML
<table border="1" cellpadding="5">
<th>Log Type</th><th>Experience Per Log</th><th>Logs Needed</th>
<tr><td>Maple</td><td>$maple</td><td>
HTML;
echo ceil("$wanted - $current" / $maple);
echo <<<HTML
</td></tr>
<tr><td>Yew</td><td>$yew</td><td>
HTML;
echo ceil("$wanted - $current" / $yew);
echo <<<HTML
</td></tr>
<tr><td>Magic</td><td>$magic</td><td>
HTML;
echo ceil("$wanted - $current" / $magic);
echo <<<HTML
</td></tr>
</table>
<br />
Thank you for using our Firemaking Calculator
HTML;
}
?>