Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $user = 'sa';
- $pass = '123';
- $host = '10.0.2.15';
- $dbname = 'Game3G';
- try{
- $dbh = new PDO ("mssql:host=$host;dbname=$dbname", "$user", "$pass");
- $n=0;
- function sorting($next,$table) {
- $temp=0;
- foreach($table as $entry) if($entry['position']==0) if($entry['level']>=$temp['level'] && $entry['exp']>=$temp['exp']) $temp=$entry;
- if($temp) {
- $table[$temp['id']]['position']=$next;
- echo '<tr>
- <td width="20px" style="font-size: 10px;">'.$next.'</td><td width="80px" style="font-size: 10px;">'.$temp['character'].'</td><td style="font-size: 10px;">'.$temp['level'].'</td> <td width="30px" style="font-size: 10px; text-align: right;">'.$temp['exp'].'%</td>
- </tr>
- ';
- sorting($next+1,$table);
- }
- }
- echo '<br> <table width="170" border=0 >';
- $i=0;
- foreach ($dbh->query('SELECT TBL_CHARACTER.FLD_LEVEL, TBL_CHARACTER.FLD_jOB, TBL_CHARACTER.FLD_CHARACTER, TBL_ABILITY.FLD_MAXEXP, TBL_ABILITY.FLD_EXP from TBL_CHARACTER LEFT JOIN TBL_ABILITY ON(TBL_CHARACTER.FLD_CHARACTER = TBL_ABILITY.FLD_CHARACTER) where TBL_CHARACTER.FLD_LEVEL < 69 and TBL_CHARACTER.FLD_jOB = 2 and TBL_CHARACTER.FLD_DELETED = 0 order by TBL_ABILITY.FLD_EXP + TBL_ABILITY.FLD_LEVEL * TBL_ABILITY.FLD_MAXEXP desc') as $row)
- {
- $i++;
- $table[$i-1]['level']=$row['FLD_LEVEL'];
- $table[$i-1]['character']=$row['FLD_CHARACTER'];
- $table[$i-1]['exp']=round(($row['FLD_EXP']/$row['FLD_MAXEXP'])*100);
- $table[$i-1]['id']=$i-1;
- $table[$i-1]['position']=0;
- $n++;
- if($n>=10) break;
- };
- sorting(1,$table);
- echo '</table><br>';
- $dbh = null;
- }
- catch(PDOException $e){
- echo 'Statystyki niedostępne.';
- }
- /*end*/
- ?>
- PHP Notice: Undefined variable: table in C:\Inetpub\wwwroot\tao.php on line 38
- PHP Warning: Invalid argument supplied for foreach() in C:\Inetpub\wwwroot\tao.php on line 12
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement