Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
Using $this when not in object context
Old 02-08-2009, 07:02 AM Using $this when not in object context
Junior Talker

Posts: 2
Name: Johan
Trades: 0
I know this has been asked before but I can't seem to figure it out

I'm getting an error that start with Fatal error: Using $this when not in object context and then goes on to include the file name and a line number. Line number 854 which is this part
Code:
if (isset($this->error_handler))
This is the code
Code:
/**
    *    error report
    */
    function error( $msg, $level = '')
    {
        $lvl = E_USER_WARNING;
        if ('fatal' == $level) $lvl = E_USER_ERROR;
        if (isset($this->error_handler))
        {
            $this->error_handler->report($lvl, $msg);
        }
        else
        {
            trigger_error("\n<br><font color='#CC0099'><b>$level:</b> $msg</font><br>\n",$lvl);
            if ('fatal' == $level) { exit; }
        }
    }
Could someone please help
JCAMaster is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 02-08-2009, 07:04 AM Re: Using $this when not in object context
rogem002's Avatar
PHP Chap

Posts: 843
Name: Mike
Location: United Kingdom
Trades: 0
$this can only be used in OOP. Check that your using it in a class and have defined it correctly.
__________________
My Blog/Site:
Please login or register to view this content. Registration is FREE
rogem002 is offline
Reply With Quote
View Public Profile Visit rogem002's homepage!
 
Old 02-08-2009, 07:24 AM Re: Using $this when not in object context
Junior Talker

Posts: 2
Name: Johan
Trades: 0
Quote:
Originally Posted by rogem002 View Post
$this can only be used in OOP. Check that your using it in a class and have defined it correctly.
Rogem

I got the software / script with the company I took over - it had a lot of bugs and still do and although I am not a programmer I have managed to sort a lot out already but I got stuck here.

SO

in short I have no idea what you mean.. and I have been searching for answers for the last 3 hours now..

JCAMaster is offline
Reply With Quote
View Public Profile
 
Old 02-08-2009, 04:12 PM Re: Using $this when not in object context
rogem002's Avatar
PHP Chap

Posts: 843
Name: Mike
Location: United Kingdom
Trades: 0
Try posting all the code up then we can debug it.
__________________
My Blog/Site:
Please login or register to view this content. Registration is FREE
rogem002 is offline
Reply With Quote
View Public Profile Visit rogem002's homepage!
 
Reply     « Reply to Using $this when not in object context
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.43985 seconds with 12 queries