Re: Call to a member function on a non-object...?
| From: | Pedro Pontes | Date: | Fri, 03 May 2002 12:26:20 +0000 |
| Subject: | Re: Call to a member function on a non-object...? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-95880@lists.php.net to get a copy of this message | ||
You must have created that function inside some class definition. When you
do that, you must first instantiate that class to have access to its
functions (methods).
If you have:
class YourClass
{
function YourClass()
{
// constructor
}
function methodOne()
{
// method 1
}
}
To call the function methodOne, you must first:
$objectName = new YourClass();
and only then
$objectName->methodOne();
Hope it helps.
--
Pedro Alberto Pontes
"Richard Brenner" <richard.brenner@endlos.at> wrote in message
news:20020503112234.85997.qmail@pb1.pair.com...
> Hi.
>
> When I try to call a manual defined function in my function.inc file, I
get
> the error:
> Fatal error: Call to a member function on a non-object in /www/xyz/.. on
> line xy
> I've defined the function in a seperate .inc file and included this is the
> mainpage.
>
> Do you have any solutions for this problem?
>
> Thanks,
> Richard
>
>