I have __construct($parameter)
public function __construct($nick) {
$query = "SELECT * FROM Users WHERE nick='".$nick."'";
$result = App::runQuery($query);
$user = $result->fetch_object();
$this->id = $user->id;
$this->nick = $user->nick;
$this->email = $user->email;
$this->password = $user->password;
$this->birthDay = $user->birthDay;
$this->sex = $user->sex;
$this->about = $user->about;
$this->city = $user->city;
$this->photo = $user->photo;
$this->following = $user->following;
$this->followers = $user->followers;
$this->statu = $user->statu;
}
And now I want to have a default constructor without parameters like this:
public function __construct() {
$this->id = NULL;
$this->nick = NULL;
$this->email = NULL;
$this->password = NULL;
$this->birthDay = NULL;
$this->sex = NULL;
$this->about = NULL;
$this->city = NULL;
$this->photo = NULL;
$this->following = NULL;
$this->followers = NULL;
$this->statu = NULL;
}
But something is wrong and I get error like this:
Fatal error: Cannot redeclare User::__construct() in /Applications/MAMP/htdocs/xxx/Application/User.php on line 33
How can I have two constructors with parameters and without parameters at the same time?