seany123 Posted November 26, 2008 Share Posted November 26, 2008 right so im making a game and the code your about to see is a basic code to update some of the players values... money and city_id. <?php header("location: home.php"); include("lib.php"); $player = check_user($secret_key, $db); ?> <?php $query = $db->execute("update `players` set `money`=?, `city_id`=2 where `id`=?", array($player->money - 1000, $player->id )); ?> The help i need is.... im wanting to make it so if the $player has less than 1000 money and/or city_id = 2.... then it would just do the redirect without doing the query. how do i do this??? Link to comment https://forums.phpfreaks.com/topic/134410-help-with-php-code/ Share on other sites More sharing options...
Maq Posted November 26, 2008 Share Posted November 26, 2008 Is this what you mean... include("lib.php"); $player = check_user($secret_key, $db); if($player->money city_id == 2) { header("location: home.php"); } else { $query = $db->execute("update `players` set `money`=?, `city_id`=2 where `id`=?", array($player->money - 1000, $player->id )); } ?> Link to comment https://forums.phpfreaks.com/topic/134410-help-with-php-code/#findComment-699748 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.