foyer wrote:where are you putting that mysql query?
you could put the query in the display grid function and just do a simple query like so:
SELECT * FROM km_sfields WHERE x='$gridx' and y='$gridy'
this could allow you to have more than 1 object at the same point.. like maybe battling or something?
No I don't mean that, sorry for my bad english I think..
First of all I still don't know what variable gridx and gridy hold, are those the position of which place is selected or what??
Second thing I mean like showing all objects/soldiers with one peace of code,
cause first you buy soldiers then you can deploy them in the field.
So I made a part of the code which i think is right I just need to know what I must put between the lines where I write this <>
echo "<td width=\"50\" height=\"50\" $bgcolor align=center valign=center><a href=\"index.php?xcord=$gridx&ycord=$gridy\">[X]</a><br><font size=1>($gridx,$gridy)</font></td>";
}
$sfields="SELECT * from km_sfield";
$sfields2=mysql_query($sfields) or die("Could not query players");
while($sfields3=mysql_fetch_array($sfields2))
{
<what must I add here to show all the images at the right postion??>
}
?>
So lets say, showing all soldiers in the map at the right postion with this code.
Another problem I found is this when I use:
$player=$_SESSION['player'];
$sfield="SELECT * from km_sfield where name='$player'";
$sfield2=mysql_query($sfield) or die(mysql_error());
$sfield3=mysql_fetch_array($sfield2) or die(mysql_error());
some codes doesnt show up, lets say this piece of code:
<?php
$player=$_SESSION['player'];
$sfield="SELECT * from km_sfield where name='$player'";
$sfield2=mysql_query($sfield) or die(mysql_error());
$sfield3=mysql_fetch_array($sfield2) or die(mysql_error());
function DisplayGrid($gridx,$gridy) {
global $x, $y;
$bgcolor = 'background="http://conquerorsofsanvia.890m.com/background/grass.gif"';
//highlight current select grid coordinate
if ($gridx == $x && $gridy == $y) {
$bgcolor = 'background="http://conquerorsofsanvia.890m.com/background/grass.gif"';
}
if ($gridx == $sfield3[x] && $gridy == $sfield3[y]) {
$imgsrc = 'img src="http://conquerorsofsanvia.890m.com/images/bowman.png"';
}
echo "<td width=\"50\" height=\"50\" $bgcolor align=center valign=bottom><a style='line-height:1em;width:75%;height:75%;display:block;' href=\"grid.php?xcord=$gridx&ycord=$gridy\"></a><br><font size=1 color='blue'>($gridx,$gridy)</font></td>";
}
[B] print "<table class='maintable'><tr class='headline'><td><center>Deploy Soldiers</center></td></tr>";
print "<tr class='mrw'><td>";
print "Each unit contains a squad of 100 units from the same class.<br>";
print "<form action='dplsoldiers.php' method='post'>";
print "<SELECT NAME='class'>";
print "<OPTION VALUE='Pikeman'>Pikeman";
print "<OPTION VALUE='Archers'>Archers";
print "<OPTION VALUE='Swordsman'>Swordsman";
print "<OPTION VALUE='Cavalry'>Cavalry";
print "</SELECT>";
print "<input type='submit' name='submit' value='submit'></form>";
print "</td></tr></table>";[/B]
?>
If I use that code the part between fat doesn't shows.
I really don't see whats wrong with that.