[request] Ranking Top Player

08/23/2020 04:56 ilyaslord36#1
hello ! evryone i need a script or php for Top ranking player and tell me how the website connect and show ranking in homepage ? i dont understand ?
thanks for all
08/23/2020 17:22 YamatosDeath#2
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';

?>
08/23/2020 22:44 ilyaslord36#3
thank you my friend