Hi guys,
I got a variable which holds many numbers, but I don't know how to use it!!
I know a bit of php, but there are things that I have not learnt yet.
Anyway this is what I mean:
In my mysql database I got information(variables) about soldiers which are on the field(grid-based map).
Each player can set his soldiers on the field, and soldiers are identificated by an ID number and they got a name which is the player name.
These are the variable from a example soldiers
[B]Soldier 1:[/B]
Position:
x=5
y=8
Identifaction:
ID=5
name=playername
class=Archer
[B]Soldier2:[/B]
Position:
x=5
y=8
Identifaction:
ID=5
name=playername
class=Warrior
[B]Soldier3:[/B]
Position:
x=5
y=8
Identifaction:
ID=5
name=playername
class=Swordsman
These variables are stored in a table of my mysql database.
Now I will get this data from the mysql set into a web page, with this piece of code.
$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));
$sfieldx=$sfield3[x];
$sfieldy=$sfield3[y];
$sfieldname=$sfield3[name]
$sfieldclass=$sfield3[class]
Okay here the problem starts now there are 3 differen soldiers which all carry the same name as the player, I want them all being showed on the grid-based world map, but $sfield3[''] holds only the variable of the first created soldier.
Can someone explain me how I can handle this??