I need help. These if statements don't work like they should... [PHP]
/*Array Info that is being pulled from the room table:
0 = ID
1 = Title
2 = Description
3 = North
4 = South
5 = East
6 = West
7 = Up
8 = Down
9 = X coord
10 = Y coord
11 = Z coord
*/
if ($dir == 1 AND $ray[3] == 1) {
++$_SESSION['xcoord'];
echo "<META HTTP-EQUIV='refresh' content='0; url=roomdisp.php'>";
} else {
echo "<META HTTP-EQUIV='refresh' content='0; url=roomdisp.php'>";
}
if ($dir == 2 AND $ray[5] == 1) {
++$_SESSION['ycoord'];
echo "<META HTTP-EQUIV='refresh' content='0; url=roomdisp.php'>";
} else {
echo "<META HTTP-EQUIV='refresh' content='0; url=roomdisp.php'>";
}
if ($dir == 3 AND $ray[4] == 1) {
--$_SESSION['xcoord'];
echo "<META HTTP-EQUIV='refresh' content='0; url=roomdisp.php'>";
} else {
echo "<META HTTP-EQUIV='refresh' content='0; url=roomdisp.php'>";
}
if ($dir == 4 AND $ray[6] == 1) {
--$_SESSION['ycoord'];
echo "<META HTTP-EQUIV='refresh' content='0; url=roomdisp.php'>";
} else {
echo "<META HTTP-EQUIV='refresh' content='0; url=roomdisp.php'>";
}
if ($dir == 5 AND $ray[7] == 1) {
++$_SESSION['zcoord'];
echo "<META HTTP-EQUIV='refresh' content='0; url=roomdisp.php'>";
} else {
echo "<META HTTP-EQUIV='refresh' content='0; url=roomdisp.php'>";
}
if ($dir == 6 AND $ray[8] == 1) {
--$_SESSION['zcoord'];
echo "<META HTTP-EQUIV='refresh' content='0; url=roomdisp.php'>";
} else {
echo "<META HTTP-EQUIV='refresh' content='0; url=roomdisp.php'>";
}[/PHP] Am I doing too much coding or would it be something in the array?
$dir = Move command
$ray[number] = 1 or 0 with 1 being TRUE and 0 being FALSE
$_SESSION['x/y/zcoord'] = Coordinate Plane