Upgrade from 1.5.4 to 3-error
Posted: Thu Nov 22, 2018 10:28 pm
My provider upgraded PHP from 5.6 to 7.2 and my site/shop stopped to work. I tried to start from upgrade of shop and follow with instructions.
But during upgrade came message
SyntaxError: Unexpected token < in JSON at position 0 OK Warning: mysqli_select_db() expects parameter 1 to be mysqli, string given in /customers/d/e/c/jordalblomster.no/httpd.www/shop1/system/library/db/mysql.php on line 12
In my file mysql.php in mentioned lines I see as below
<?php
namespace DB;
final class MySQL {
private $connection;
public function __construct($hostname, $username, $password, $database, $port = '3306') {
if (!$this->connection = mysqli_connect($hostname . ':' . $port, $username, $password)) {
trigger_error('Error: Could not make a database link using ' . $username . '@' . $hostname);
exit();
}
if (!mysqli_select_db($database, $this->connection)) {
throw new \Exception ('Error: Could not connect to database ' . $database);
}
mysqli_query("SET NAMES 'utf8'", $this->connection);
mysqli_query("SET CHARACTER SET utf8", $this->connection);
mysqli_query("SET CHARACTER_SET_CONNECTION=utf8", $this->connection);
mysqli_query("SET SQL_MODE = ''", $this->connection);
+++++++++++++
What shall I correct?
I already chnaged in words mysql to mysqli
Thanks in advance for help
But during upgrade came message
SyntaxError: Unexpected token < in JSON at position 0 OK Warning: mysqli_select_db() expects parameter 1 to be mysqli, string given in /customers/d/e/c/jordalblomster.no/httpd.www/shop1/system/library/db/mysql.php on line 12
In my file mysql.php in mentioned lines I see as below
<?php
namespace DB;
final class MySQL {
private $connection;
public function __construct($hostname, $username, $password, $database, $port = '3306') {
if (!$this->connection = mysqli_connect($hostname . ':' . $port, $username, $password)) {
trigger_error('Error: Could not make a database link using ' . $username . '@' . $hostname);
exit();
}
if (!mysqli_select_db($database, $this->connection)) {
throw new \Exception ('Error: Could not connect to database ' . $database);
}
mysqli_query("SET NAMES 'utf8'", $this->connection);
mysqli_query("SET CHARACTER SET utf8", $this->connection);
mysqli_query("SET CHARACTER_SET_CONNECTION=utf8", $this->connection);
mysqli_query("SET SQL_MODE = ''", $this->connection);
+++++++++++++
What shall I correct?
I already chnaged in words mysql to mysqli
Thanks in advance for help