its a little bit crappy in my eyes...
this works too:
PHP Code:
<?php
include 'config.php'; //connection
$i = 1;
$query = mssql_query("SELECT TOP 1 Name, Level FROM characters WHERE DeleteFlag = 0 ORDER BY XP/PlayTime DESC"); //searching top by xp times playtime...
while($row = mssql_fetch_row($query)) //making rows
{
echo '<tr><td>'.$i++.'</td> <td><a href="?page=charinfo&name='.$row[0].'">'.$row[0].'</a></td></tr><br>'; //showing rows (only name and auto numbering)
}
?>
config:
PHP Code:
<?php
class connect
{
var $host = "..\SQLEXPRESS"; // Host, usually PCNAME\SQLEXPRESS
var $user = "sa"; // Username is usually empty.
var $pass = "pass"; // Password is usually empty.
var $dbn = "GunzDB"; // Database name is most likely GunzDB.
public function __construct()
{
$con = mssql_connect($this->host, $this->user, $this->pass) or die("<center><font color='red'>Failed to connect to the database!</font></center>");
mssql_select_db($this->dbn, $con) or die("<center><font color='red'>Failed to select the database!</font></center>");
}
}
new connect();
?>
credits to SuperWaffle
and me for editing it O.o