Code: Select all
<?php
echo "<br/><table><tr><td><font size='5'><b> Current Village Summery</b></font></td></tr></table><br/>";
?>
<?php
echo "<table border='0' style='border-width: 1px; border-color:#000000; border-style: solid; margin-left: 68;'><tr><td><b><font size='4'> Building </font></b></td>" . "<td><b><font size='4'> Level </font></b></td></tr>";
?>
<?php
$buildingsinfo=("SELECT * from player_buildings WHERE userid='$uid' AND cityid='$cityview'");
$buildingsinfo2=mysql_query($buildingsinfo) or die("could not get building levels");
while($buildingsinfo3=mysql_fetch_array($buildingsinfo2))
{
if ($buildingsinfo3['buildingtype'] == "townhall"){
$filename = $buildingsinfo3['buildingtype'];
$buildingid = $buildingsinfo3['buildingid'];
$townhallinfo=mysql_query("SELECT level from buildings WHERE id='$buildingid'") or die("could not get townhall info");
$level = mysql_fetch_array($townhallinfo);
echo "<tr><td><center>" . $filename . "</center></td><td><center>" . $level['level']. "</center></td></tr>";
}
if ($buildingsinfo3['buildingtype'] == "warehouse"){
$filename = $buildingsinfo3['buildingtype'];
$buildingid = $buildingsinfo3['buildingid'];
$townhallinfo=mysql_query("SELECT level from buildings WHERE id='$buildingid'") or die("could not get townhall info");
$level = mysql_fetch_array($townhallinfo);
echo "<tr><td><center>" . $filename . "</center></td><td><center>" . $level['level']. "</center></td></tr>";
}
}
echo "</table>";
?>ok. now im trying to kinda do the same thing for the troops, exept the table is different that for the buildings. in the buildings, every building has its own row, but in the troops, the table is like this:
id userid cityid axemen slinger spearmen archer swordmen scout ranger knight ram catapult
1 7 24 5 17 25 50 30 10 5 3 2 6
and this is how i tried to code this, but its not working:
Code: Select all
<?php
$troops = mysql_query("SELECT * FROM player_troops WHERE userid='$uid' AND cityid='$cityview'");
$troops2 = mysql_fetch_array($troops);
echo $troops2['axemen'];
?>[/code
like i at least need it to display something out of that table before i go ahead and create the whole table. so im trying to echo the axemen that player has, and its not displaying anything....