OO PHP error

This is a discussion on "OO PHP error" within the PHP Forum section. This forum, and the thread "OO PHP error are both part of the Program Your Website category.



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

Notices


Reply
 
LinkBack Thread Tools
  #1 (permalink)  
Old Aug 27th, 2007, 22:33
alexgeek's Avatar
Technical Administrator

SuperMember
Join Date: Jul 2007
Location: Webforumz 24/7
Age: 15
Posts: 3,770
Blog Entries: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to alexgeek
OO PHP error

hello. I've written a PHP OO script that uses the class user and admin (admin is extended of user).
I can functions as an admin from the user class but the functions the functions in the admin class return this error:
"Fatal error: Call to undefined method User::getAdmin() in C:\Filespace\Testsite\class.php on line 96"
which would leave me to assume that i have written a function called getAdmin, but i have. Could someone check this code for me when they have the spare time? Sorry it's a lot.



PHP: Select all

..ry);
if (
$userinfo['4'] == 3) {
$admin = new Admin;
$admin = new User
$admin->name htmlentities($_SESSION['user']);
$admin->ty.. 
Last Blog Entry: 3D Chess in your browser! (Mar 14th, 2008)

Last edited by alexgeek; Aug 28th, 2007 at 13:29.
Reply With Quote

  #2 (permalink)  
Old Aug 27th, 2007, 23:40
Up'n'Coming Member
Join Date: Jun 2007
Location: Birmingham, UK
Posts: 54
Thanks: 0
Thanked 0 Times in 0 Posts
Re: OO PHP error

Hi
I didn't go through the code in detail, but the first thing that strikes is that you use the classes User and Admin before they are defined in the script.

I suspect a second error in the following lines
Code: Select all
 if ($userinfo['4'] == 3) {
$admin = new Admin;
$admin = new User; 
...
You first assign an Admin object to $admin and then a User object, discarding the Admin object. Maybe you should remove the line
Code: Select all
$admin = new User;

Hope that helps
Reply With Quote
  #3 (permalink)  
Old Aug 28th, 2007, 00:11
alexgeek's Avatar
Technical Administrator

SuperMember
Join Date: Jul 2007
Location: Webforumz 24/7
Age: 15
Posts: 3,770
Blog Entries: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to alexgeek
Re: OO PHP error

works perfectly now
thanks for spotting that
reps you *
Last Blog Entry: 3D Chess in your browser! (Mar 14th, 2008)
Reply With Quote
  #4 (permalink)  
Old Aug 28th, 2007, 10:06
Up'n'Coming Member
Join Date: Jun 2007
Location: Birmingham, UK
Posts: 54
Thanks: 0
Thanked 0 Times in 0 Posts
Re: OO PHP error

Quote:
Originally Posted by alexgeek View Post
works perfectly now
thanks for spotting that
reps you *
Thanks, I like to help
Reply With Quote
Reply

Tags
php, classes, class

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
[SOLVED] Getting the "Microsoft JET Database Engine error '80040e14'" error. VegaLA Classic ASP 3 Jan 26th, 2008 00:12
Keep getting error message Microsoft VBScript runtime error '800a01a8' cpando1974 Classic ASP 2 Aug 7th, 2007 12:00
Error 500 - Internal server error JasonStanley PHP Forum 3 Apr 23rd, 2007 17:56


All times are GMT. The time now is 11:35.


Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs 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 43