I am having a problem with a set of php code (well several, but will display only one for now) Here is some snippets of the function and the place where the "purchase land" is, the database name where the land value is kept is called 'land':
This is where the html that calls the above is:
Now the prob is it takes the money out of the treasury ok, but does not add the land when called upon. Right now it displays 100 acres of land owned, but when I buy land, it still shows 100 cres, even though phpmyadmin shows a higher and proper amount.
There is a similar code for troops, and that works fine.
Code:
elseif ($userrow["treasury"] >= $total)
{
$land = $userrow["land"];
$newgold = $userrow["treasury"] - $total;
$newland = $userrow["land"] + $landacres;
$page = "<table width=100%><tr><td class=title align=center>Castle ".$userrow["landname"]."</td></tr></table><br>";
$page .= "<table width=100%><tr><td align=center height=400 valign=top>You bought $landacres acres of land.<br><br>";
$page .= "Go back and <A href='index.php?do=land'>manage</a> your land.</td></tr></table>";
$query = doquery("UPDATE {{table}} SET treasury='$newgold', land='$newland' WHERE id='".$userrow["id"]."' LIMIT 1", "users");
}
}
This is where the html that calls the above is:
Code:
<table width=100% cellpadding=0 cellspacing=0 border=0 align=center><tr><td align=center class=title>
<b>Territory for ".$userrow["landname"]." Castle
</b></td></tr></table>
<table width=98% cellpadding=0 cellspacing=0 border=0><tr><td align=center>
You may purchase an acre of land for 250 gold. Higher land values increases the amount of taxes you collect, and how many soldiers you can hold. You can have 10 soldiers per acre of land you own.
<br><br><center>
<form action=\"index.php?do=land\" method=\"post\"><input type=\"submit\" name=\"buyland\" value=\"purchase\" /> <input type =\"text\" name=\"landacres\" size=\"5\" /></form> acres
</center><br><br>
</td></tr></table>
Now the prob is it takes the money out of the treasury ok, but does not add the land when called upon. Right now it displays 100 acres of land owned, but when I buy land, it still shows 100 cres, even though phpmyadmin shows a higher and proper amount.
There is a similar code for troops, and that works fine.
Last edited: