Connecting Tech Pros Worldwide Help | Site Map

PHP Fatal error: Cannot access empty property

Tarantulus's Avatar
Member
 
Join Date: May 2007
Posts: 103
#1: Jun 20 '08
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="tmc-tectest";
$this->username="root";
$this->password="cr1m50n";
$this->ident=mysql_connect($this->$database,$this->$username,$this->$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's Avatar
Site Moderator
 
Join Date: Apr 2007
Location: Texas
Posts: 5,435
#2: Jun 27 '08

re: PHP Fatal error: Cannot access empty property


Heya, Tarantulus.

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