<td width="696" height="100%" valign="top" colspan="2">
                        <table border="0" cellpadding="0" cellspacing="0" width="800">
                                <tr>
                                        <td valign="top">
                                                <table border="0" width="800">
                                                        <tr>
                                                                <td width="200" background="img/bg_balk.jpg"><b>Total</b></td>
                                                                <td width="120" background="img/bg_balk.jpg"><b>Base (cloacked)</b></td>
                                                                <td width="120" background="img/bg_balk.jpg"><b>Base (uncloacked)</b></td>
                                                                <td width="120" background="img/bg_balk.jpg"><b>Fleet 1</b></td>
                                                                <td width="120" background="img/bg_balk.jpg"><b>Fleet 2</b></td>
                                                                <td width="120" background="img/bg_balk.jpg"><b>Fleet 3</b></td>
                                                        </tr>
                                                        <?
                                                        while ($res_getships = mysql_fetch_array($rec_getships)) {
                                                        	if (!checkitem($playerdata['id'], $res_getships['depends'])) { continue; }
                                                        	$sql_stock = "SELECT `amount` FROM $table[playerunit] WHERE `player_id` = '$playerdata[id]' AND `unit_id` = '$res_getships[id]'";
                                                        	$rec_stock = mysql_fetch_array(mysql_query($sql_stock));
                                                        	if ($rec_stock['amount'] <= 0) { $stock = 0; }
                                                        	else { $stock=$rec_stock['amount']; }

                                                        	$sql_fleets = "SELECT * FROM $table[fleet] WHERE `player_id` = '$playerdata[id]' AND `ship_id` = '$res_getships[id]'";
                                                        	$rec_fleets = mysql_fetch_array(mysql_query($sql_fleets));
														?>
														<tr>
															<td><?echo $stock.' '.$res_getships['name'].'s'; ?></td>
															<td><?echo $rec_fleets['base_cloacked'];?></td>
															<td><?echo $rec_fleets['base_uncloacked'];?></td>
															<td><?echo $rec_fleets['fleet_1'];?></td>
															<td><?echo $rec_fleets['fleet_2'];?></td>
															<td><?echo $rec_fleets['fleet_3'];?></td>
				<tr>
					<td valign="top">
						<table border="0" width="800">
							<tr>
								<td width="400" background="img/bg_balk.jpg"><b>Unit name</b></td>
								<td width="50" background="img/bg_balk.jpg"><b>Steel</b></td>
								<td width="50" background="img/bg_balk.jpg"><b>Crystal</b></td>
								<td width="50" background="img/bg_balk.jpg"><b>Erbium</b></td>
								<td width="50" background="img/bg_balk.jpg"><b>Titanium</b></td>
								<td width="50" background="img/bg_balk.jpg"><b>ETA</b></td>
								<td width="50" background="img/bg_balk.jpg"><b>Amount</b></td>
								<td width="100" background="img/bg_balk.jpg">&nbsp;</td>
							</tr>
							<?
							while ($res = mysql_fetch_array($rec_getdefense)) {
								if (!checkitem($playerdata['id'], $res['depends'])) { break; }
							?>
							<form method="POST" action="main.php?mod=factory&act=build&type=defense&id=<?echo $res['id'];?>">
							<tr>
								<td><?echo $res['name']; ?></td>
								<td><?echo $res['cost_steel']; ?></td>
								<td><?echo $res['cost_crystal']; ?></td>
								<td><?echo $res['cost_erbium']; ?></td>
								<td><?echo $res['cost_titanium']; ?></td>
								<td><?echo $res['eta']; ?></td>
								<td><input type="text" name="amount" size="5"></td>
								<td><input type="submit" name="buildships" value=" Build "></td>
							</tr>
							</form>
							<?
							}