2
I am unable to use the "mysqli_connect" function. Can anyone help me? You are returning the following error:
Fatal error: Constant Expression contains invalid Operations in /home/Vagrant/Projetos/products/app/Database/Connection.php on line 11
This is my code:
<?php
namespace App\Database\Connection;
class Connection
{
protected $host = '127.0.0.1';
protected $user = 'homestead';
protected $password = 'secret';
protected $database = 'products_crud';
protected $connection = mysqli_connect($this->host, $this->user, $this->password, $this->database);
}
The error happens in this line of code:
protected $connection = mysqli_connect($this->host, $this->user, $this->password, $this->database);