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

Perl - how to grep a block of text from a file -

delphi - How to remove all the grips on a coolbar if I have several coolbands? -

javascript - Animating array of divs; only the final element is modified -