php - CodeIgniter function not show? -


helper.website.php

public function load_top_players() {      $this->load->lib(array('rank_db', 'db'), array(host, user, pass,characters));     $query = $this->rank_db->query('select name, access users order access desc limit 5');     while($row = $query->fetch()) {         $this->rank[] = array(             'name'  => htmlspecialchars($row['name']),             'level' => (int)$row['access']         );     }     return $this->rank; } 

view.header.php

<?php $rank = load::get('website'); $i = 1; foreach ($rank $pos => $player) {     $first = (in_array($i, array(1))) ? '' : '';     $second = (in_array($i, array(2))) ? '' : '';     echo '<tr style="'.$first.' '.$second.' '.$third.'">         <td  >'.$i.'</td>         <td>'.$player['name'].'</td>         <td>'.$player['access'].'</td>     </tr>';     $i++; } ?> 

it shows blank page, no errors no nothing!

helper.website.php

public function getonlinecount(){         $this->load->lib(array('rank_db', 'db'), array(host, user, pass, characters));           return $this->registry->rank_db->snumrows('select count(name) count users status <> -1 , sub_status>= 1');     } 

and in in view.header.php <?php echo load::get('website')->getonlinecount() ; ?> works perfect ! how can transform query


Popular posts from this blog

c# - ODP.NET Oracle.ManagedDataAccess causes ORA-12537 network session end of file -

matlab - Compression and Decompression of ECG Signal using HUFFMAN ALGORITHM -

utf 8 - split utf-8 string into bytes in python -