Ok, Ive managed to sort out $name. I realised I had being using $POST instead of $SESSION.
But $object[5]->y on the other hand...well, I'm having trouble with it.
First I have
if (($_POST[x])||($_POST[y]))
{
$playerx = $_POST[x];
$playery = $_POST[y];
}
else {
$playerx = mysql_query("SELECT `x` FROM players WHERE `username`='".$_SESSION['username']."'");
$playery = mysql_query("SELECT `y` FROM players WHERE `username`='".$_SESSION['username']."'");
if (((!$playerx)||(!$playery))||(($playerx<=0)||($playery<=0)))
{
$playerx = 2;
$playery = 2;
}
}
and then
$result = array();
$i = 1;
while ($i <= 9)
{
$result[$i] = mysql_query("SELECT * FROM map WHERE x = '$x[$i]' AND y = '$y[$i]'");
$i += 1;
}
$object = array();
$i = 1;
while ($i <= 9)
{
$object[$i] = mysql_fetch_object($result[$i]);
$i += 1;
}
to assign it. But I cant work out where its going wrong.
Could it be a problem with the if statements I am using to define $playerx and $playery? But if it is, why is it only affecting $playery, and not $playerx as well.