0
votes

I don't understand why this line:

$this->db = mysqli($db['host'],$db['user'],$db['pass'],$db['name']);

Give me that error:

[05-Jul-2017 11:55:26 Europe/Berlin] PHP Fatal error: Uncaught Error: Cannot use object of type mysqli as array in /var/www/***/public_html/core/classes.php:7

Stack trace: #0 /var/www/***/public_html/core/classes.php(19): Database->connectDatabase()

1 /var/www/***/public_html/index.php(5): Core->__construct()

2 {main} thrown in /var/www/***/public_html/core/classes.php on line 7

I'm running Ubuntu Apache PHP7, phpinfo() does mention the mysqli ext.

1

1 Answers

0
votes

Did you tried with keyword new before mysqli

$this->db = new mysqli($db['host'],$db['user'],$db['pass'],$db['name']);

Also check, is any of given parameters to mysqli function is array (it may cause the error). $db['host'],$db['pass'],$db['user'],$db['name'] should be strings