mike177 Posted January 16, 2008 Share Posted January 16, 2008 Hi, I have been writing my own login script for my site. I have completed the registration systems and now working out all the errors - problem is I'm using classes and something’s going wrong. I get a fatal error when I try to use a function located in another file. I've tried making the functions public, global - everything. I can't find any descent tutorials so it's no longer a self-help issue. The exact error message is: Fatal error: call to a member function on a non-object in /home/www/mnielsen.awardspace.com/login/files/session.php on line 31. I've attached the complete source code for the registration system. The errors are occurring in the session.php file on line 31 and the database_functions.php file on line 16 and 24. Thanks in advance for any help [attachment deleted by admin] Quote Link to comment Share on other sites More sharing options...
toplay Posted January 16, 2008 Share Posted January 16, 2008 Well, for starters I don't see how $form is set in your register() method within the Session class. Also, the function setError() that it's calling is not defined within you Session class. Unfortunately it doesn't look like you yet understand the basics of OOP. It's a good start though. I think you need to pick up a book on PHP - there are lots with OOP style. Our tutorials: http://www.phpfreaks.com/tutorial_cat/19/Object-Oriented-Programming.php Google the web, there's lots. Quote Link to comment Share on other sites More sharing options...
KrisNz Posted January 16, 2008 Share Posted January 16, 2008 You have a typo for starters, else if($datbase->emailTaken($subemail)){ Plus you'll have to do a global $database; inside the function(register) you're trying to use your database class in. Making it global outside of the class might work too, I'm not sure, I never use globals. Quote Link to comment Share on other sites More sharing options...
mike177 Posted January 16, 2008 Author Share Posted January 16, 2008 Well, for starters I don't see how $form is set in your register() method within the Session class. Also, the function setError() that it's calling is not defined within you Session class. Unfortunately it doesn't look like you yet understand the basics of OOP. It's a good start though. I think you need to pick up a book on PHP - there are lots with OOP style. Our tutorials: http://www.phpfreaks.com/tutorial_cat/19/Object-Oriented-Programming.php Google the web, there's lots. --------------------- Thanks so much, I forgot 1 line at the start of the function. Cheers mate Quote Link to comment Share on other sites More sharing options...
mike177 Posted January 16, 2008 Author Share Posted January 16, 2008 You have a typo for starters, else if($datbase->emailTaken($subemail)){ Plus you'll have to do a global $database; inside the function(register) you're trying to use your database class in. Making it global outside of the class might work too, I'm not sure, I never use globals. ------------------- Cheers mate, I did just need to make the $database and form objects global Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.