Jump to content

[PHP] Record online


Recommended Posts

Posted

<?php
$db_host = "localhost";
$db_user = "mangos";
$db_pass = "password";
mysql_connect($db_host,$db_user,$db_pass);
mysql_select_db("realmd");
$query = 'SELECT starttime,uptime,maxplayers FROM uptime ORDER BY maxplayers DESC LIMIT 1';
$result = mysql_query($query);
$row = mysql_fetch_array($result,MYSQL_ASSOC);

echo "Record online: ".$row['maxplayers']." on " . date("Y-m-d H:i:s",$row['starttime']+$row['uptime']);
?>

I threw this together very quickly so there is no type of error checking, but the php doesn't matter so much as the sql query is the part doing what you want. I also included the date of the record (starttime + uptime)

Edit: although the date itself is not the time the record was reached but the date the server was started+how long its been up, i mainly included it just as an example of what can be done with the data

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. Privacy Policy Terms of Use