php - Call a member function on a non object -


i want display informations object activity function getcurrent() listactivity should returns. when try it, works perfectly, have information needed class, but, have error message on top of page :

fatal error: call member function getidentifiant() on non-object in /applications/xampp/xamppfiles/htdocs/site/prototype/administration.php on line 34

line 34 here :

  while($listactivities->next())   {      $current = new activity();      $current = $listactivities->getcurrent();      echo $current->getid(); // line 34   } 

and getcurrent() function return activity object.

  public function getcurrent()   {      if(isset($this->activities[$this->current]))         return $this->activities[$this->current];   } 

i don't understand why have problem since returns me object want. please me figuring out. thanks.

echo $current->getid(); // line 34 fatal error: call member function getidentifiant() on non-object in /applications/xampp/xamppfiles/htdocs/site/prototype/administration.php on line 34 

whatever think happens, or whatever see in page, if error says $current not object, not. might not null, array or not object.

also :

$current = new activity(); $current = $listactivities->getcurrent(); 

doesn't makes sense me.

use

var_dump($listactivities->getcurrent()); 

to see returns, , trust errors say.

edit : , may not looking @ right php script acually : error says "getidentifiant" while code says "getid". make sure you're looking @ right piece of code , refreshing right page.


Comments

Popular posts from this blog

c++ - Function signature as a function template parameter -

algorithm - What are some ways to combine a number of (potentially incompatible) sorted sub-sets of a total set into a (partial) ordering of the total set? -

How to call a javascript function after the page loads with a chrome extension? -