$result2 = mysql_query($query, $con);
while($data2 = mysql_fetch_assoc($result2))
{
$x = $data2["x"];
$y = $data2["y"];
echo "$x";
echo "$y";
if($x<0 && $y<0)
{
echo "village: $data[village] ";
echo "player: $data[player] ";
echo "position: ($data[x]|$data[y])<br>";
}
else if($x>0 && $y>0)
{
echo "village: $data[village] ";
echo "player: $data[player] ";
echo "position: ($data[x]|$data[y])<br>";
}
else if($x>0 && $y<0)
{
echo "village: $data[village] ";
echo "player: $data[player] ";
echo "position: ($data[x]|$data[y])<br>";
}
}
I am getting the error
Notice: Undefined index: y in C:\xampp\htdocs\debal\nw_check_exec.php on line 48
Notice: Undefined index: x in C:\xampp\htdocs\debal\nw_check_exec.php on line 47
line 47 and line 48 are:-
$x = $data2["x"];
$y = $data2["y"];
I think i have done all things properly, and i am unable to figure out the cause of the error.
Properbly the
$data2has really no indexxso you need to check that and use instat a default value.You can use for that a small inline if statment:
By the way do you have really defined so much constants? E.g. here:
This means that there must be a constant
villagemaybe with some value “village”?Maybe you should exchange that with a: