McBryver Posted March 7, 2011 Share Posted March 7, 2011 Hello I am trying to get an action status based on e.g attackers_1 troops. Unfortunately I get nothing when I die the $strikeaction var here is my function and method I use to call it. <?php function getStrikeAction($id){ $q = "SELECT * FROM `accountinfo_db` WHERE `id` = '$id'"; $res = mysql_query($q) or die(mysql_error()); $player = mysql_fetch_array($res); if($player['siegetech']>=1){ $strikeaction=($player['attackers_1'] * $player['siegetech'] * 120); $strikeaction+=($player['attackers_2'] * $player['siegetech'] * 1200); $strikeaction+=($player['attackers_3'] * $player['siegetech'] * 80); }else{ $strikeaction=($player['attackers_1'] * 120); $strikeaction+=($player['attackers_2'] * 1200); $strikeaction+=($player['attackers_3'] * 80); } $id = $player['id']; $q = "UPDATE `accountinfo_db` SET `strikeaction` = '$strikeaction' WHERE `id` = '$id'"; $res = mysql_query($q) or die(mysql_error()); return $stikeaction; } ?> <?php echo getStrikeAction($player['id']);?> Link to comment https://forums.phpfreaks.com/topic/229836-strike-action-will-not-calculate/ Share on other sites More sharing options...
MasterACE14 Posted March 7, 2011 Share Posted March 7, 2011 typo at the end return $stikeaction; should be return $strikeaction; Link to comment https://forums.phpfreaks.com/topic/229836-strike-action-will-not-calculate/#findComment-1183919 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.