Join the forums now, and start posting to receive access to our Scripts Vault!
<?phpinclude "library.php";include "func.php";connect();$userquery = mysql_query("SELECT * FROM users WHERE id='1' LIMIT 1");$userrow = mysql_fetch_array($userquery);$do = explode(":", $_GET['do']);//Now check what to doif($do[0] == "move") { move($do[1]); }echo $userrow["position_x"];echo "<br/>" . $userrow["position_y"];?>
<?phpfunction move($dir) { $x = $userrow["position_x"]; $y = $userrow["position_y"]; if($dir == "n") { $x2 = $x + 1; $string = "position_x='$x2'"; } if($dir == "s") { $x2 = $x - 1; $string = "position_x='$x2'"; } if($dir == "e") { $y2 = $y + 1; $string = "position_y='$y2'"; } if($dir == "w") { $y2 = $y - 1; $string = "position_y='$y2'"; } if($dir == "") { header("Location: index.php"); }//Now update the database.mysql_query("UPDATE users SET $string WHERE id='1' LIMIT 1");}?>
2) You need to learn to solve these smaller issues for yourself...
As said before: set $userrow as global variable in index.php