PDA

View Full Version : Call to Member function on a non-object


ZeepySea
10-23-2009, 01:39 AM
I created a class to handle my groups info. But when I try to get the info from the db I get.

Call to a member function query_read() on a non-object

Is there a special way to call $db->query_first_slave() or query_read from inside a custom class?

Lynne
10-23-2009, 01:51 AM
It kinda depends. I can't really say since you haven't posted what you wrote. Could be:
$this->registry->db->query_first_slave()

ZeepySea
10-23-2009, 11:36 PM
I figured it out, when I created the class I passed the object $vbulletin in, then checked that it was an object and if so assigned it to $this->registry

I was doing exactly what you was showing, but it didn't work