The main code
PHP Code:
<?php
$connectionInfo = array( "UID"=>$uid,"PWD"=>$pwd,"Database"=>$t_databse, "CharacterSet" => "UTF-8");
$conn = sqlsrv_connect( $Hostip, $connectionInfo);
if( $conn === false )
die( FormatErrors( sqlsrv_errors() ));
$sql = "SELECT top 10 name, lv FROM Character WHERE permission=0 AND lv<301 ORDER by exp DESC";
$query = sqlsrv_query($conn, $sql);:
if ($query === false)
die( FormatErrors( sqlsrv_errors() ));
$counter = 0;
while ($row = sqlsrv_fetch_array($query)){
if ($counter >= 10)
break;
else {
$counter++;
}
echo '<br><ul class="top"><li style="width: 100px">'.$row['lv'].'</li><li style="width: 140px">'.$row['name'].'</li><li style="width: 35px">'.$counter.'</li></ul><br>';}
?>
Config
PHP Code:
<?php
$Hostip = "127.0.0.1"; /// the server ip
$uid = "sa"; /// sql username
$pwd = "123"; /// the connection password
$database = 'Auth'; /// this is not really needed in your case :D
$t_databse = 'Telecaster';
?>