Forum Moderators: coopster
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
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
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
################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);
?>