Help With Script Please

This script listed below is supposed to show a World with rooms. the rooms are stored on the database. But for some reason it keeps saying “That Room Dosnt Exist” Can anyone help me?

<? $title = "world"; include("header.php");

if ($_GET['room']) {
	
$room = mysql_fetch_array(mysql_query("select * from `world` where id='$room'"));
$world = mysql_fetch_array(mysql_query("select * from `world` where id='$stat[room]'"));
 



if (empty ($world[id])) {
	print "That room doesnt exist";

	exit;
}
if($stat[rank] != Admin) {
if($room[id]!=$stat[room]){
if($room[north]!=$stat[room] and $room[south]!=$stat[room] and $room[west]!=$stat[room] and $room[east]!=$stat[room]){
print "You are not next to this room..";

exit;
}
}
}

$thedate=gmdate(DATE_RFC822);
$ip = $REMOTE_ADDR;
mysql_query("insert into move_log (userid, ip, userip, roomid, last) values('$stat[id]','$ip','$stat[ip]','$room[id]','$stat[room]')") or exit("MySQL Error :  " . mysql_error()); 

mysql_query("update users set room='$room[id]' where id='$stat[id]'");

print"<center><table border=2>";
print"<tr bgcolor=#666666><td width=500 colspan=2><center><b>$room[name]<b></center><br></td></tr>";
print"<tr bgcolor=#333333><td width=250 ><center>


<img src=$room[roompic] border=0 usemap=#map>



</center></td><td width=250>$room[desc]</td></tr>";
print"<tr bgcolor=#333333 ><td width= 250><center>";
if ($room[north] > 0) {
print"<b><a href=World.php?room=$room[north]>NORTH</a></b>";
}else{
print "North";
}
print "</center><br><center>";

if ($room[west] > 0) {
print"<b><a href=World.php?room=$room[west]>WEST</a></b>   ";
}else{
print "West   ";
} 
print"";
if ($room[east] > 0) {
print" <b><a href=World.php?room=$room[east]>EAST</a></b>";
}else{
print " East";
}
print"</center><br><center>";
if ($room[south] > 0) {
print"<b><a href=World.php?room=$room[south]>SOUTH</a></b>";
}else{
print "South";
}


print"</center><td>";
print"Mobs in this room:<br><br>";
	$mob1 = mysql_query("select * from mobs WHERE room=$room[id] order by attack");
	while ($mob = mysql_fetch_array($mob1)) {
$times_attacked =  mysql_num_rows(mysql_query("select * from mobatt  where player='$stat[id]' and mob='$mob[id]'"));

if ($times_attacked >= $stat[mobt]) {
}else{
print"<a href=matt.php?id=$mob[id]>$mob[name]</a> Level: $mob[level]";
if ($mob[type] == Q) {
print"<a href=mob1.php?mob=$mob[id]>(<b><font color=green>TALK</font></b></font>)</a>";
}
print"
<br>";
}
}

	$raid1 = mysql_query("select * from rmob WHERE room=$room[id] order by attack");
	while ($raid = mysql_fetch_array($raid1)) {

if ($raid[alive]  == 0) {
print "<font color=gray>$raid[name]</font><br>";

}else{
print"<b>*<a href=ratt.php?id=$raid[id]>$raid[name]</a>*</b>  <br>";
}
}
print"</td>";
print"
</tr>
</center></table>";
exit;
}

	
$room = mysql_fetch_array(mysql_query("select * from `world` where id='$stat[room]'"));
$world = mysql_fetch_array(mysql_query("select * from `world` where id='$stat[room]'"));
 



if (empty ($world[id])) {
	print "That room doesnt exist";
	
	exit;
}
if($stat[rank] != Admin) {
if($room[id]!=$stat[room]){
if($room[north]!=$stat[room] and $room[south]!=$stat[room] and $room[west]!=$stat[room] and $room[east]!=$stat[room]){
print "You are not next to this room..";

exit;
}
}
}
mysql_query("update users set room='$room[id]' where id='$stat[id]'");

print"<center><table border=2>";
print"<tr bgcolor=#666666><td width=500 colspan=2><center><b>$room[name]<b></center><br></td></tr>";
print"<tr bgcolor=#333333><td width=250 ><center><img src=$room[roompic]></center></td><td width=250>$room[desc]</td></tr>";
print"<tr bgcolor=#333333><td width= 250><center>";
if ($room[north] > 0) {
print"<b><a href=World.php?room=$room[north]>NORTH</a></b>";
}else{
print "North";
}
print "</center><br><center>";

if ($room[west] > 0) {
print"<b><a href=World.php?room=$room[west]>WEST</a></b>   ";
}else{
print "West   ";
} 
print"";
if ($room[east] > 0) {
print" <b><a href=World.php?room=$room[east]>EAST</a></b>";
}else{
print " East";
}
print"</center><br><center>";
if ($room[south] > 0) {
print"<b><a href=World.php?room=$room[south]>SOUTH</a></b>";
}else{
print "South";
}


print"</center><td>";
print"Mobs in this room:<br><br>";
	$mob1 = mysql_query("select * from mobs WHERE room=$room[id] order by attack");
	while ($mob = mysql_fetch_array($mob1)) {
$times_attacked =  mysql_num_rows(mysql_query("select * from mobatt  where player='$stat[id]' and mob='$mob[id]'"));

if ($times_attacked >= $stat[mobt]) {
}else{
print"<a href=matt.php?id=$mob[id]>$mob[name]</a> Level: $mob[level]";
if ($mob[type] == Q) {
print" <a href=mob1.php?mob=$mob[id]>(<b><font color=green>TALK</font></b>)</a>";
}
print"
<br>";
}
}

	$raid1 = mysql_query("select * from rmob WHERE room=$room[id] order by attack");
	while ($raid = mysql_fetch_array($raid1)) {

if ($raid[alive]  == 0) {
print "<font color=gray>$raid[name]</font><br>";

}else{
print"<b>*<a href=ratt.php?id=$raid[id]>$raid[name]</a>*</b>  <br>";
}

}
print"</td>";
print"
</tr>
</center></table>";


?>

Have you tried debugging? What errors do you get when you use error_reporting(E_ALL);?

Sponsor our Newsletter | Privacy Policy | Terms of Service