Deprecated: Creation of dynamic property db::$required is deprecated in /home1/include/connection.php on line 24
Fatal error: Uncaught Error: Object of class mysqli could not be converted to string in /home1/include/connection.php:27 Stack trace: #0 /home1/include/connection.php(471): db->__construct() #1 /home1/include/index.php(1): include(‘/home1/…’) #2 {main} thrown in /home1/include/connection.php on line 27
My Code:
class db
{
var $iConn;
private $dbHost;
private $dbUser;
private $dbPass;
private $dbName;
public function __construct(){
$this->dbHost = "localhost";
$this->dbUser = "thewcmp_automation";
$this->dbPass = "6K_l+W)74Sv5";
$this->dbName = "thewcmp_dashboard";
$iConn = $this->required = mysqli_connect($this->dbHost, $this->dbUser, $this->dbPass, $this->dbName);
//check connection
if (mysqli_connect_errno($this->$iConn))
{
echo "Failed to connect to MySQL:" . mysqli_connect_error();
}
}
}
Is this bcoz of PHP version? or any help please.
Can any one guide me or correct the Code for me please. Thanks in advance