• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Windows [MODERNACC]Needing help with website

khang123321

New Member
Joined
Jan 3, 2011
Messages
25
Reaction score
2
I'm trying to make a top 5 rebirth list but so far i only have it showing the players id :T like this..

Code:
. 92
Rebirths: 800
1. 93
Rebirths: 400
2. 25
Rebirths: 2
3. 66
Rebirths: 2
4. 85
Rebirths: 1
5.

the script is
PHP:
<?PHP
//** Connection to the database **//
$ots = POT::getInstance();
$ots->connect(POT::DB_MYSQL, connection());
$SQL = POT::getInstance()->getDBHandle();

//** Top Players + online status By Kavvson **//
                                $money_list = $SQL->query('SELECT `player_id`, `value` FROM `player_storage` WHERE `key` = 85987 ORDER BY `value` DESC LIMIT 5')->fetchAll();
                                        foreach($money_list as $money_chr){
                                        echo '<center>';
                                            echo $i.'. <a href="'.WEBSITE.'/index.php/character/view/'.$money_chr['player_id'].'">';
        $player = $ots->createObject('Player');
        $player->find($money_chr['player_id']); 
                        echo '<font color="';
                        echo ($player->isOnline()) ? 'green' : 'red';
                        echo '">';    
                        echo '<b>'.$money_chr['player_id'].'</b></a></font>';
                        echo  '<br>Rebirths: <B>'.$money_chr['value'].'</B><br>';
                                            $i++;
                                        }
                                        for( $i; $i <= 5; $i++ ){
                                            echo $i.'. <br><i>Empty</i><br /><br />';
                                        }
                                        echo '</center>';
                                        
?>
help please ! i am bad at websites
 
Last edited:
$i = 1; before the foreach loop sloves the wrong count bug.

and the only thing you select are the players_ids and the storage value?

if you wanna get the players name and vocation and other stuff you need to do a other sql for making it look WHERE id = $money_list['player_id']

something like that
 
i don't get wat u mean and you might not get wat i mean so here's a picture to make sure you know wat i want :D Untitled.png
Instead of recieving the players_id numbers i what their names like this Untitled2.png
thank you !!

- - - Updated - - -

bump
 
PHP:
<?PHP 
//** Connection to the database **// 
$ots = POT::getInstance(); 
$ots->connect(POT::DB_MYSQL, connection()); 
$SQL = POT::getInstance()->getDBHandle(); 

//** Top Players + online status By Kavvson **// 
                                $money_list = $SQL->query('SELECT `player_id`, `value` FROM `player_storage` WHERE `key` = 85987 ORDER BY `value` DESC LIMIT 5')->fetchAll();
                                        foreach($money_list as $money_chr){ 
$char_list = $SQL->prepare("SELECT `name` FROM `players` WHERE id= :id");
$char_list = $char_list->execute(':id' => $money_list['player_id']);
$char = $char_list->fetch();
                                        echo '<center>'; 
                                            echo $i.'. <a href="'.WEBSITE.'/index.php/character/view/'.$char['name].'">'; 
        $player = $ots->createObject('Player'); 
        $player->find($money_chr['player_id']);  
                        echo '<font color="'; 
                        echo ($player->isOnline()) ? 'green' : 'red'; 
                        echo '">';     
                        echo '<b>'.$char['name].'</b></a></font>'; 
                        echo  '<br>Rebirths: <B>'.$money_chr['value'].'</B><br>'; 
                                            $i++; 
                                        } 
                                        for( $i; $i <= 5; $i++ ){ 
                                            echo $i.'. <br><i>Empty</i><br /><br />'; 
                                        } 
                                        echo '</center>'; 
                                         
?>

im not sure it will work and its a really bad way of doing this...
i edited inside here and not on my editor so cant se it either
 
Back
Top