[PHP] Re: Call to a member function on a non-object...?
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 [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... 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 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Call to a member function on a non-object error!
Fatal error: Call to a member function on a non-object in /home/cmradmin/public_html/thus/basket.php on line 304 Does anyone know what the flaming heck that means? I'm trying to fix this little problem which has only appeared since my webserver upgraded to PHP4. Line 304 contains this: $MyCart-Display($Orderno); PHP thinks that $MyCart ain't an object, much less a Cart object. At line 303, insert: echo MyCart is a , vartype($MyCart), BR\n; vardump($MyCart); and see what you get. -- WARNING [EMAIL PROTECTED] address is an endangered species -- Use [EMAIL PROTECTED] Wanna help me out? Like Music? Buy a CD: http://l-i-e.com/artists.htm Volunteer a little time: http://chatmusic.com/volunteer.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Re: Call to a member function on a non-object error!
[EMAIL PROTECTED] (Greg Fyans) wrote: Fatal error: Call to a member function on a non-object in /home/cmradmin/public_html/thus/basket.php on line 304 Does anyone know what the flaming heck that means? I'm trying to fix this little problem which has only appeared since my webserver upgraded to PHP4. Line 304 contains this: $MyCart-Display($Orderno); have you initialized you object before using it? like: $MyCart = new MyCart; -- Henrik Hansen -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]