Go Back   Novahq.net Forum > phphq.Net > phphq.Net Forums

 
 
Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 01-16-2005, 12:44 PM
varg
Unregistered

Posts: n/a

babstats server online

I'm trying to put a status note in my forums saying if our main server is running. Using babstats.
Here's what I've got so far, it's working, but it echoes all the servers. I'd like it to echo just the server with a certain ID - I guess that has to be specified in the $query, but I'm not sure how to do just that.

[code:1:26d24b6abe]
<?
$dbh=mysql_connect ('localhost', 'username', 'password') or die(mysql_error());
mysql_select_db(dbname,$dbh) or die(mysql_error());


$query = mysql_query("SELECT * FROM `bab_servers` ORDER BY name") or die(mysql_error());
$thetime = time();
while($row = mysql_fetch_array($query)) {
if($thetime > ($row[last_update] + 120)) {
echo "Server is offline";
} else {
echo "Server is online";
} }
?>

[/code:1:26d24b6abe]
this is how it looks now. as you can see, it shows the offline servers aswell. While I only want it to show the last, online server, which is ID=5 in the database.
I'm no php expert, so help is most appreciated

//EDIT:
problem fixed, you can now delete this post if you want to.
in case someone wants to know
[code:1:26d24b6abe]
$dbh=mysql_connect ('localhost', 'username', 'password') or die(mysql_error());
mysql_select_db(dbname,$dbh) or die(mysql_error());
$id = "5";
$query = mysql_query("SELECT * FROM `bab_servers` WHERE id=$id") or die(mysql_error());
$thetime = time();
while($row = mysql_fetch_array($query)) {
if($thetime > ($row[last_update] + 120)) {
echo "<a href=\"http://www.mapmakersheaven.com/server.php\">server is<font size=\"2\" color=\"#871C01\"><strong> offline </strong></font></a>";
} else {
echo "<a href=\"http://www.mapmakersheaven.com/server.php\">server is<font size=\"2\" color=\"#006600\"><strong> online </strong></font></a>";
} }[/code:1:26d24b6abe]
Reply With Quote
 


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
normandy server back online gasemans107th Gaming Talk 9 06-05-2006 05:15 AM
babstats server status block -SpArKs- Delta Force 2 07-29-2005 04:38 AM
|FG| LW server online!!! Monkey Br.=FoT= News 0 03-12-2004 12:59 PM
BHD clans Using PHPnuke/Babstats server status block xacuta.ck Delta Force 0 01-14-2004 12:30 PM
Our Server Online Frootie ÐÐT Gaming Talk 4 12-12-2002 11:47 AM


All times are GMT -5. The time now is 05:24 PM.




Powered by vBulletin®