[Need Help With Error] Fatal error: Using $this when not in object context

Discussion in 'PHP' started by procrastinator, Mar 17, 2007.

  1. #1
    Im getting this error

    Fatal error: Using $this when not in object context in /home/imagepun/public_html/include/common.php on line 11






    line 11 in common.php is
    $this->min_pass_length=8;


    does this mean the database user pass ? if yes then yes my password is 8 numbers long , also i tried to change the 8 to 6 , however the error was still there.
     
    procrastinator, Mar 17, 2007 IP
  2. maonnie

    maonnie Member

    Messages:
    71
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    43
    #2
    Its saying can't use $this->xxx outside of a class - post the first 10 lines of common.php and I'll see if I can help.

    It's nothing to do with the value - it's because you're trying to call a method on $this and $this isn't valid in the context that you're using it.
     
    maonnie, Mar 18, 2007 IP
  3. procrastinator

    procrastinator Peon

    Messages:
    1,718
    Likes Received:
    56
    Best Answers:
    0
    Trophy Points:
    0
    #3
    ah, here goes

    <?
    session_start();
    include("config.php");
    $att_path = "./uploads";
    $paypal_item = $sitename." Service Monthly Subscription";
    $paypal_item_number = $sitename;
    $mainipn = $siteurl."/ipn.php";
    $paypal_ipn = $siteurl."/site_ipn.php";
    $paypal_cancel_return = $siteurl."/cancel.php";
    $paypal_return = $siteurl."/thanks.php";
    $this->min_pass_length=6;
    $this->max_pass_length=12;
     
    procrastinator, Mar 18, 2007 IP
  4. datropics

    datropics Peon

    Messages:
    309
    Likes Received:
    3
    Best Answers:
    1
    Trophy Points:
    0
    #4
    I believe you ought to be using the name of the class in "config.php" instead of $this in those lines.
     
    datropics, Mar 18, 2007 IP
  5. hawk007

    hawk007 Peon

    Messages:
    1
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    I read your answer to the problem and the problem itself and i am having the exact same problem, same lines etc. ie line 11, same exact problem. However i didnt understand your responce. Could you give some practical instruction on what to do to correct the problem.

    Thank you
     
    hawk007, Jun 26, 2007 IP
  6. nico_swd

    nico_swd Prominent Member

    Messages:
    4,153
    Likes Received:
    344
    Best Answers:
    18
    Trophy Points:
    375
    #6
    ^^ Post your code.
     
    nico_swd, Jun 26, 2007 IP