$fleet_id = $rec_playerfleet['id'];
			$sql_findpships = "
				SELECT $table[ships].id, $table[ships].firepower, $table[ships].armor, $table[playerfleet_ships].id AS unique_id,
						$table[playerfleet_ships].player_id, $table[playerfleet_ships].fleet_id, $table[playerfleet_ships].ship_id, $table[playerfleet_ships].type_id, 
						$table[playerfleet_ships].class_id,	$table[playerfleet_ships].amount, $table[playerfleet_ships].primary, $table[playerfleet_ships].secondary
						FROM `$table[ships]` INNER JOIN $table[playerfleet_ships]
						ON $table[ships].id = $table[playerfleet_ships].ship_id					
						WHERE
						$table[playerfleet_ships].player_id = '$id' AND 
						$table[playerfleet_ships].fleet_id = '$fleet_id'
						";
			$res_findpships = mysql_query($sql_findpships) or die('SQL ERROR (finding player-defendships)\n'.mysql_error());
			$num_findpships = @mysql_num_rows($res_findpships);
			if ($num_findpships > 0) {
				while ($rec_findpships = mysql_fetch_assoc($res_findpships)) {
					$defendfleet->addShips($rec_findpships['unique_id'], $id, $fleet_id, $rec_findpships['ship_id'], $rec_findpships['amount'], $rec_findpships['armor'], $rec_findpships['firepower'], $rec_findpships['primary'], $rec_findpships['secondary']);
				}
			}
		}
	}

	for ($y = 0; $y < count($shipdata); $y++) {
		$single_shipdata = $shipdata[$y];
		$ship_id = $single_shipdata['id'];;
		unset($defend_shipcollection, $attack_shipcollection);

		if ($defendfleet) {
			$defend_shipcollection = $defendfleet->getShipCollection($ship_id);
			for ($i = 0; $i < count($defend_shipcollection); $i++) {
				if (($defend_shipcollection[$i]->getPrim() > 0) || ($defend_shipcollection[$i]->getSec() > 0)) {
					$ship_amount = $defend_shipcollection[$i]->getAmount();