Hi and thanks for getting back to me. 🙂 I tries the session_destroy(); and it did what it was supposed to. lol. Too well in fact. It certainly would keep them from refreshing the page though. 😛
Here is what I am going for. I want them to either create a new account or sign in. Either way they go to this page. That all works like a charm. Once they are here they see thier current stats and have the option to do a job which has predefined stats of its own. They choose a job and hit submit, and it will add or subtract the jobs stats to the players stats. Thus the long query. What I want to keep from happening is that is does the job again if you refresh to see you new stats. Ultimatly I want it to do the job and update to show the new stats without the refresh doing the job again. Then they have the option to do another job and the same thing happens.
Basicly if you have ever played Mob Wars, I am doing a newborn version of that. Just for practise mind you oh great Mob Wars creator dude. 😛
Here is the code for the top of the page if it will help. It shows why I used the session user name in the query, I couldn't figur out another way. Would I use $SESSION["user"] = $playername or something like that?
<?php
session_start();
if (array_key_exists("user", $_SESSION)) {
echo "Hello " . $_SESSION["user"];
}
else {
header('Location: index.php');
exit;
}
//this is where mysql info and some other functions are housed
require_once("Includes/db.php");
?>
//this diplays the players current stats.
<html>
<head></head>
<body>
<table border="black">
<tr>
<th>User Name</th>
<th>Nickname</th>
<th>Level</th>
<th>Cash</th>
<th>Energy</th>
<th>XP</th>
</tr>
<?php
require_once("Includes/db.php");
$playerID = getajobDB::getInstance()->get_player_id_by_name(mysql_real_escape_string($_SESSION["user"]));
$result = getajobDB::getInstance()->get_player_by_players_id($playerID);
while($row = mysql_fetch_array($result)) {
strip_tags($row["user_name"],'<br><p><h1>');
echo "<tr><td>" . $row["user_name"]."</td>";
strip_tags($row["nickname"],'<br><p><h1>');
echo "<td>".$row["nickname"]."</td>";
strip_tags($row["my_level"],'<br><p><h1>');
echo "<td>".$row["my_level"]."</td>";
strip_tags($row["cash"],'<br><p><h1>');
echo "<td>".$row["cash"]."</td>";
strip_tags($row["energy"],'<br><p><h1>');
echo "<td>".$row["energy"]."</td>";
strip_tags($row["xp"],'<br><p><h1>');
echo "<td>".$row["xp"]."</td>";
echo "</tr>\n";
}
//the top part to here works great.
?>
</table>
Thanks again. 🙂
Kate