Hi Guys im trying to get a code that would allow me to increase my attack and my defence using items i have purchased
my data base for items is playershipweapons
and the data base i am trying to increase stats is playerships
ive been trying to get it sorted for a week now but cant get it working any help will be Greatly appretiated thanks
help needed plz
Re: help needed plz
My advice would be not to store that information, rather calucalte it when it's needed.
Code: Select all
$shipQuery = mysql_query("SELECT * FROM `playerships` WHERE `id` = 1"); // id = ships id
$shipData = mysql_fetch_assoc($shipQuery);
$totalAttack = $shipData['attack'];
$totalDefence = $shipData['defence'];
$equipmentQuery= mysql_query("SELECT * FROM `playershipweapons` WHERE `equipped` = 1");
while( $equipmentArray = mysql_fetch_assoc($shipEquipmentQuery) )
{
$totalAttack += $equipmentArray['attack_bonus'];
$totalDefence += $equipmentArray['defence_bonus'];
}
echo 'attack bonus: ' . $totalAttack . '<br />';
echo 'defence bonus: ' . $totalDefence;
Fighting for peace is declaring war on war. If you want peace be peaceful.