Forum Moderators: coopster

Message Too Old, No Replies

parse error, unexpected T_VARIABLE

         

djdiper

4:45 pm on Aug 17, 2005 (gmt 0)

10+ Year Member



Hi,

I'm working on a webpage that will display server stats. The code is as follows;

################Game Server Status#########################
include("decoder_east.php"); helix/NORAD/decoder_east.php
$JOresult = mysql_query("SELECT * FROM e_servers WHERE ServerName = 'HeliX Norway'");
while($JOquery_data = mysql_fetch_array($JOresult)) {
$JOname = $JOquery_data["ServerName"];
$JOmap = $JOquery_data["MissionName"];
$JOtype = $JOquery_data["GameType"];
$JOnum = $JOquery_data["Players"];
$JOmax = $JOquery_data["MaxPlayers"];
}
if($JOname == "") {
echo "<br><img src=/helix/NORAD/img/offline.gif> ", "HeliX Norway <br>is offline<br><br><br>"; #

the exact name of your server and correct path to img.
} else {
echo "<br>Game : JOTR<br>";
echo "Server : ",$JOname,"<br>";
echo "Status : ","<img src=helix/NORAD/img/online.gif> Online!<br>"; # correct path to img.
echo $JOmap,"<br>";
echo "Type : ",$JOtype,"<br>";
echo "Players : ",$JOnum,"/",$JOmax,"<br><br>";
}
mysql_close($dbh);
?>

I get error in line 15, the part with offline image. Can you spot an error in the code? Haven't worked with this alot, but I do want this to work on my gaming site!

Thanks in advance for assistance!

Regards,

Diper

sned

4:54 pm on Aug 17, 2005 (gmt 0)

10+ Year Member



Hi djdiper, welcome to WebmasterWorld!

echo "<br><img src=/helix/NORAD/img/offline.gif> ", "HeliX Norway <br>is offline<br><br><br>"; #

the exact name of your server and correct path to img.

The comment (#) should be all on one line, something like:

echo "<br><img src=/helix/NORAD/img/offline.gif> ", "HeliX Norway <br>is offline<br><br><br>"; #the exact name of your server and correct path to img.

-sned

djdiper

5:09 pm on Aug 17, 2005 (gmt 0)

10+ Year Member



Hi Sned.
Thx for the welcome :D

I have changed it to one line, but it doesn't seem to help..
Other ideas?

sned

5:36 pm on Aug 17, 2005 (gmt 0)

10+ Year Member



Oops .. didn't see this part:

include("decoder_east.php"); helix/NORAD/decoder_east.php

Maybe the helix/NORAD/decoder_east.php is a comment:

include("decoder_east.php"); #helix/NORAD/decoder_east.php

-sned

djdiper

5:54 pm on Aug 17, 2005 (gmt 0)

10+ Year Member



There are three locations of the servers. Eastside, westside and international. So think the code is correct on that line.

sned

5:57 pm on Aug 17, 2005 (gmt 0)

10+ Year Member



This part - helix/NORAD/decoder_east.php - is just floating out there then .. what does it go to? Should it go in the include statement?

You might try putting the # in front of it just to see what happens.

djdiper

6:24 pm on Aug 17, 2005 (gmt 0)

10+ Year Member



Can I send you the ReadMe file for the program?

Maybe you can get an answer out of it?

sned

6:35 pm on Aug 17, 2005 (gmt 0)

10+ Year Member



Sure, go right ahead.

-sned

djdiper

8:45 pm on Aug 17, 2005 (gmt 0)

10+ Year Member



Hope you can figure something out Sned.

Thanx for all your help!

djdiper

6:26 am on Aug 18, 2005 (gmt 0)

10+ Year Member



I could say that this is under the gamestat.php file! :D

sned

4:08 pm on Aug 18, 2005 (gmt 0)

10+ Year Member



Ok, got the readme file this time :)

What happens if you change this line:

include("decoder_east.php"); helix/NORAD/decoder_east.php

to:

include("helix/NORAD/decorder_east.php");

djdiper

4:51 pm on Aug 18, 2005 (gmt 0)

10+ Year Member



Hi Sned..
Tried making the changes..

Look what came now:

Warning: main(helix/NORAD/decorder_east.php) [function.main]: failed to open stream: No such file or directory in /home/djdiper/public_html/helix/NORAD/gamestat.php on line 14

Warning: main() [function.include]: Failed opening 'helix/NORAD/decorder_east.php' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/djdiper/public_html/helix/NORAD/gamestat.php on line 14

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/djdiper/public_html/helix/NORAD/gamestat.php on line 16

/ Diper

sned

4:53 pm on Aug 18, 2005 (gmt 0)

10+ Year Member



Ok, how about just this then:

include("decorder_east.php");

djdiper

4:54 pm on Aug 18, 2005 (gmt 0)

10+ Year Member



Now the gamestatfile looks like this:

################Game Server Status#########################
include("helix/NORAD/decorder_east.php");
$JOresult = mysql_query("SELECT * FROM e_servers WHERE ServerName = 'HeliX Norway'");
while($JOquery_data = mysql_fetch_array($JOresult)) {
$JOname = $JOquery_data["ServerName"];
$JOmap = $JOquery_data["MissionName"];
$JOtype = $JOquery_data["GameType"];
$JOnum = $JOquery_data["Players"];
$JOmax = $JOquery_data["MaxPlayers"];
}
if($JOname == "") {
echo "<br><img src=/helix/NORAD/img/offline.gif> ", "HeliX Norway <br>is offline<br><br><br>"; #the exact name of your server and correct path to img.
} else {
echo "<br>Game : JOTR<br>";
echo "Server : ",$JOname,"<br>";
echo "Status : ","<img src=helix/NORAD/img/online.gif> Online!<br>"; # correct path to img.
echo $JOmap,"<br>";
echo "Type : ",$JOtype,"<br>";
echo "Players : ",$JOnum,"/",$JOmax,"<br><br>";
}
mysql_close($dbh);
?>

djdiper

4:58 pm on Aug 18, 2005 (gmt 0)

10+ Year Member



I could Kiss the ground you are walking on, Sned!

You got this working.. :d

Thanx a million!