Re: More ???s on passing variables
| From: | Paul Dionne | Date: | Thu, 01 Aug 2002 11:59:04 +0000 |
| Subject: | Re: More ???s on passing variables | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-110658@lists.php.net to get a copy of this message | ||
Jason Wong wrote:
> On Wednesday 31 July 2002 22:40, Paul Dionne wrote:
>>
>> I have a class in my script which has information on specific tables such
>> as standard queries, tablenames, Index field...
>>
>> Then there is a function called StandardDropDown($ItemNum, $Name) which
>> gets the info from the appropriate table you want and displays a dropdown
>> menu based on the table.
>>
>> $ItemNum referrs to the table I want to output, $Name is what I want to
>> call the dropdown in the HTML output.
>>
>> When I call the function directly from a page it works great.
>>
>> When I call it from another function I get an error:
>> Fatal error: Call to a member function on a non-object in
>> /var/www/html/COMESA/theme/functions.inc on line 61
>>
>> This is line 61: $TableName= $ItemNum->get_TableName();
>>
>> As I said, I only get this error when I call from a function, not if I
>> call
>> directly from a page. I don't see why that should make any difference
>> though.
>
> In your function declare your object as global.
>
I will do that and see if it helps, but why should that make a difference?
I would like to know what I am doing wrong in general.