PHP Fatal error: Cannot access empty property

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Tarantulus
    New Member
    • May 2007
    • 114

    PHP Fatal error: Cannot access empty property

    Hi Guys,

    I'll keep this short and sweet:


    [PHP]
    class connection{
    public $database;
    public $username;
    public $password;
    public $ident;

    public function __construct(){
    $this->database="tm c-tectest";
    $this->username="root ";
    $this->password="cr1m 50n";
    $this->ident=mysql_co nnect($this->$database,$thi s->$username,$thi s->$password);
    }

    }

    [/PHP]

    what is wrong with that?

    error is Fatal error: Cannot access empty property in /www/wwwroot/tools/projects/functions.php on line 13

    EDIT: Sorry, Solved it, I was being an idiot. I should have used $this->var instead of $this->$var
  • pbmods
    Recognized Expert Expert
    • Apr 2007
    • 5821

    #2
    Heya, Tarantulus.

    Glad to hear you got it sorted out. Good luck with your project!

    Comment

    Working...