Queries in a location-script
Posted: Wed Aug 10, 2005 2:26 am
Hey again..I'm experiencing some troubles with this code that's supposed to update the users location in the db when one of the 4 north, east, west, south submit buttons is pressed:
The problem is that if I press south twice, and then press the east button; Theninstead of instantly doing the East query it once again does the south query. What did I miss??
Code: Select all
//North
if(isset($_POST['North'])!==false&&$user[Latitude]>2){
doquery("UPDATE `users` SET `Latitude` = Latitude -1 WHERE `userID` ={$_SESSION['userID']} LIMIT 1 ");
echo"<center>You moved 1 field north and was not attacked</center>";
}
//South
if(isset($_POST['South'])!==false&&$user[Latitude]<16){
doquery("UPDATE `users` SET `Latitude` = Latitude +1 WHERE `userID` ={$_SESSION['userID']} LIMIT 1 ");
echo"<center>You moved 1 field south and was not attacked</center>";
}
//East
if(isset($_POST['East'])!==false&&$user[Longitude]<16){
doquery("UPDATE `users` SET `Longitude` = Longitude +1 WHERE `userID` ={$_SESSION['userID']} LIMIT 1 ");
echo"<center>You moved 1 field east and was not attacked</center>";
}
//West
if(isset($_POST['West'])!==false&&$user[Longitude]>2){
doquery("UPDATE `users` SET `Longitude` = Longitude -1 WHERE `userID` ={$_SESSION['userID']} LIMIT 1 ");
echo"<center>You moved 1 field west and was not attacked</center>";
}