Fatal error: Call to a member function getName() on a non-object

This is a discussion on "Fatal error: Call to a member function getName() on a non-object" within the PHP Forum section. This forum, and the thread "Fatal error: Call to a member function getName() on a non-object are both part of the Program Your Website category.


 Subscribe in a reader

Go Back   Webforumz.com > Main Forums > Program Your Website > PHP Forum

Notices




Reply
 
LinkBack Thread Tools
  #1  
Old Apr 7th, 2006, 09:01
Junior Member
Join Date: Jan 2005
Posts: 16
Thanks: 0
Thanked 0 Times in 0 Posts
Fatal error: Call to a member function getName() on a non-object

I tell you something chaps this is killin me!

Fatal error: Call to a member function getName() on a non-object! I have posted this problem a few times but it keeps coming back to haunt me and I am losing faith in storing objects in sessions altogether!

Some of my classes have an update method that updates a Page, a Product, an Image etc via a HTML front end. Now the Product class' update function works perfectly well, however the Page and Link class both give the Fatal Error. Each class uses the same process so it's baffling, plus all of the functions work perfectly on my local machine it's just my web server that is giving me grief!

This is the update function of the Page class:

PHP: Select all

class Page{
...
 
function 
updatePage($_POST$uri){
$userId=$_SESSION['user']->getUserId();
 
$_SESSION['page'] = unserialize($_SESSION['page']);
$pageName=$_SESSION['page']->getName();
$windowTitle=$_SESSION['page']->getWindowTitle();
$HTML=$_SESSION['page']->getContent();
serialize($_SESSION['page']);
 
***
update code****
... 
and the product class, which works uses the same process:

PHP: Select all

class Product{
...
function 
updateProduct($_POST$uri){
 
 
$_SESSION['product']=unserialize($_SESSION['product']);
$description $_SESSION['product']->getDescription();
$shortDescription $_SESSION['product']->getShortDescription();
$productName $_SESSION['product']->getName();
$price $_SESSION['product']->getPrice();
$images=$_SESSION['product']->getImageNamesArray();
$productInCats=$_SESSION['product']->getProdInCategoryAsArray();
$_SESSION['product']=serialize($_SESSION['product']);
 
***
update code****
... 
now I know the object is there because doing a var_dump($_SESSION) shows me the page object and its associated attributes. I am on PHP5 and I know register_globals is switched on with my host.I have taken the advice to include an autoload function as well to try and combat the problem but it still remains!

Please restore my faith in PHP SESSION Objects.

If i have not made myself clear please feel free to ask me to post more code or more info.

Thanks a million!!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote

  #2  
Old Apr 13th, 2006, 18:53
Junior Member
Join Date: Jan 2006
Posts: 20
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Fatal error: Call to a member function getName() on a non-object

Post the getName() function! It may be you have a constructor for getName not setting the object member variable right.

Also check that your files aren't getting corrupted for some reason on upload if you're FTPing to the web server.

Cheers

Dan
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Reply

Tags
fatal, error, call, member, function, getname, nonobject

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Call to a non object fatal error alexgeek PHP Forum 2 Feb 21st, 2008 15:34
fatal error alexgeek Webforumz Cafe 3 Aug 27th, 2007 22:16
call php function in image url csun PHP Forum 16 Aug 19th, 2007 18:49
Fatal error: call to a member function funtion() on a non-object timcallagy Databases 2 Mar 4th, 2007 21:55
Having trouble with scripts. Fatal error: Call to undefined function: imagegif() cargi PHP Forum 5 Jan 6th, 2006 18:59


All times are GMT. The time now is 02:26.


Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0 RC8
© 2003-2008 Webforumz.com : All Rights Reserved

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42