For some reason I cannot get a value changed in a database with a script. I am designing an MMORPG using PHP for use in the browser, and I need to make a server-status script.
But for some reason I cannot get the value to update, here is the code (excluding database username, password, etc).
PHP Code://The MySQL Variables
$server = "---";
$username = "---";
$password = "---";
$database = "tfdo_e";
$username1 = $_SESSION['UserName'];
$password1 = $_SESSION['PassWord'];
mysql_connect($server,$username,$password);
@mysql_select_db($database) or die("Unable to select database");
//Send Query To Set Players + 1
$query="SELECT Kingdom FROM tfdo_e_users WHERE Username=$username1 AND Password=$password1";
$kingdom=mysql_query($query);
if ($kingdom == "FOD")
{
$playerkingdom = "Forest of Draagul";
}
if ($kingdom == "VOS")
{
$playerkingdom = "Valley of Snakes";
}
if ($kingdom == "CON")
{
$playerkingdom = "City of Nahana";
}
$query="SELECT Server FROM tfdo_e_server WHERE Server=$playerkingdom";
$number=mysql_query($query);
$finalnumber=$number+1;
$query="UPDATE tfdo_e_server SET Players='$finalnumber' WHERE Server='$playerkingdom'";
mysql_query($query);
}
else
{
js_redirect_notloggedin();
}
function js_redirect_notloggedin($url="notloggedin.php", $seconds=0.1) {
echo "<script language=\"JavaScript\">\n";
echo "<!-- hide from old browser\n\n";
echo "function redirect() {\n";
echo "window.location = \"" . $url . "\";\n";
echo "}\n\n";
echo "timer = setTimeout('redirect()', '" . ($seconds*100) . "');\n\n";
echo "-->\n";
echo "</script>\n";
return true;
}







Reply With Quote