You might as well add a reference of your db-object to global scope.

[code]
$GLOBALS['_db_object'] =& $db;
[/code]

Then you could access it anywhere in your code like this:

[code]
$GLOBALS['_db_object']->sumbitQuery($query);
[/code]


Daniel


Angelo Binc2 wrote:
Ok guys, I have fixed the problem and its a really easy fix. basically
the object was out of scope and therefore PHP treated my object name as
a new variable and therefore it obvioulsy was not set because it is a
new variable. SO the way I got it working was to just call the code
directly and not put it in  a function, or you could pass the object to
the function as an argument.

Hope this can help others in the future!
Angelo


"Jason Paschal" <[EMAIL PROTECTED]> 7/2/2004 11:22:04 AM >>>

would it be necessary/possible to make it global inside the function?


---------------------------------------------------------
http://www.dailymedication.com - Everything you didn't know you
needed until you went there and said to yourself, "What did I do before I
visited DailyMedication.com?" and another part of you said, "It does not
matter."







From: "Angelo binc2" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Subject: [PHP] Object is not instatiated on POST, Fatal error
Date: Fri, 02 Jul 2004 11:14:53 +0200

Hi all,

I have a PHP file. and when it loads it creates an object for my
database :

include("db_class.inc");

fine.

I make a couple of calls to the database class this is also working
fine. Then I post the page but to itself and then I go into a

function

(lets call it xfunction) which is ONLY accessed once the form has

been

posted and I get a fatal error:

Fatal error: Call to a member function on a non-object in c:\program
files\apache group\apache\htdocs\zero\opdocument.php on line 98


From what I've read my database object is not instatiated and
therefore

is in theory not an object. However I check before I go into the
xfunction to see if the object is set and it is, then once in the
function (where the error occurs) I test to see if the object is set
again and it tells me that the object is not set.

What could be the reason for the object not being set once being

called

in the function (xfunction)?? I have googled and many people get this
error but not many have a clear solution.

Any help or suggestions will be appreciated.
Thanks

Angelo
--------------------------------------------------------------------
Disclaimer
This e-mail transmission contains confidential information,
which is the property of the sender.
The information in this e-mail or attachments thereto is
intended for the attention and use only of the addressee.
Should you have received this e-mail in error, please delete
and destroy it and any attachments thereto immediately.
Under no circumstances will the Cape Technikon or the sender
of this e-mail be liable to any party for any direct, indirect,
special or other consequential damages for any use of this e-mail.
For the detailed e-mail disclaimer please refer to
http://www.ctech.ac.za/polic or call +27 (0)21 460 3911

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




_________________________________________________________________
MSN Life Events gives you the tips and tools to handle the turning
points in your life. http://lifeevents.msn.com


--------------------------------------------------------------------
Disclaimer This e-mail transmission contains confidential information,
which is the property of the sender.
The information in this e-mail or attachments thereto is intended for the attention and use only of the addressee. Should you have received this e-mail in error, please delete and destroy it and any attachments thereto immediately. Under no circumstances will the Cape Technikon or the sender of this e-mail be liable to any party for any direct, indirect, special or other consequential damages for any use of this e-mail.
For the detailed e-mail disclaimer please refer to http://www.ctech.ac.za/polic or call +27 (0)21 460 3911


--
WWE e-commerce IT GmbH
Eiffestrasse 462, D-20537 Hamburg
Tel.: +49-40-2530659-0, Fax: +49-40-2530659-50

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Reply via email to