Jump to content

Strike action will not calculate.


McBryver

Recommended Posts

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.