Possible Duplicate:
Fatal error: Call to a member function query() on a non-object in
I have a class file, lets call it 'stuff'
Stuff.class
inside there is a class
class Stuff {
and in there I have a public static function
public static function morestuff() {
}
Inside I need to call another function for a query
$q="Select from contacts where id =". $this->$db->escapeVal($ID)".";
But I get errors.
$q="Select from contacts where id =". escapeVal($ID)".";
Returns
Call to undefined function escapeVal()
$q="Select from contacts where id =". $db->escapeVal($ID)".";
Returns
Call to a member function escapeVal() on a non-object
$q="Select from contacts where id =". $this->$db->escapeVal($ID)".";
Returns
Using $this when not in object context
So what do I put?
EDIT:
A similar function in the same file has the following code
'id' = '" . $this->db->escapeVal($this->_Id) . "'
However when I try to use this code in my mysql query I get the following error
Using $this when not in object context