[Fixed] Call to a member function getRankMembers() on a non-object

FirefighterKyle

I am Kyle!!
Sep 14, 2012
162
7
Okay so I am trying to implement more OOP, but I am getting this error.

Here is the codes I am using
PHP:
final public function Initiate()
    {
        global $_CONFIG, $officer, $engine, $core, $template;
        $this->setParams('gameName', $_CONFIG['game']['name']);
        $this->setParams('shortName', $_CONFIG['game']['short']);
        $this->setParams('gameVersion', $_CONFIG['game']['version']);
        $this->setParams('year', $_CONFIG['server']['year']);
        $this->setParams('url', $_CONFIG['game']['url']);
       
        $this->setParams('mysql_host', $_CONFIG['mysql']['hostname']);
        $this->setParams('mysql_port', $_CONFIG['mysql']['port']);
       
        $this->setParams('skin', $_CONFIG['template']['skin']);
       
        if($officer->isLogged())
        {
            $this->setParams('userid', $officer->getInfo($_SESSION['officer']['id'], 'id') );
            $this->setParams('username', $officer->getInfo($_SESSION['officer']['id'], 'name'));
            $this->setParams('email', $officer->getInfo($_SESSION['officer']['id'], 'email'));
            $this->setParams('ip_last', $officer->getInfo($_SESSION['officer']['id'], 'ipaddress_last'));
            $this->setParams('lastOnline', date('M j, Y H:i:s A', $officer->getInfo($_SESSION['officer']['id'], 'last_online')));
        }
                   
            if ($_GET['url'] == 'army')
            {
                $rank->getRankMembers();
                $rank->recentActivity();
            }
       
    }

I did the following which was move the `}` from isLogged()) underneath the `if statement` which removes the error but on my .php page I type the Params what to show on the page which is {rankMemebers} but on the page it just shows that not the whole code I typed out for it?
If need to be I will update this & add in my other OOP page if someone needs to see it to further help me.
 

griimnak

You're a slave to the money then you die
Jul 20, 2013
957
800
the only way i learned oop php is by using static methods for everything:

PHP:
<?php
class something {
     public static function something() {
          echo 'function';
     }
   
     public static function finish() {
          self::something(); //call a function in this class
     }
}

//execute
something::finish();
this is very similar to python

anyways sorry if that was off topic, but in my situation i'd make sure isLoggedIn is a static function() and i'd call it from a seperate db like something::isLoggedIn();
 

Users who are viewing this thread

Top