Skip to content

Commit cfaf15c

Browse files
committed
change mysqli_connect to mysqli object
1 parent 902a37b commit cfaf15c

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

Database/drivers/mysqli.php

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ public function __construct() {
2323
}
2424

2525
public function connect($dbname, $hostname='localhost', $username='root', $password='', $failover=FALSE, $charset='utf8') {
26-
$this->dbcon = @mysqli_connect(
26+
$this->dbcon = @new mysqli(
2727
$hostname,
2828
$username,
2929
$password,
@@ -33,13 +33,14 @@ public function connect($dbname, $hostname='localhost', $username='root', $passw
3333
if ($failover === FALSE) {
3434
if ( ($this->dbcon->connect_errno) ) {
3535
header('X-Error-Message: Fail Connecting', true, 500);
36-
die("Failed to connect to MySQL: " . $this->dbcon->connect_errno);
36+
die("Failed to connect to MySQL: " . $this->dbcon->connect_err);
3737
}
3838
}
3939

4040
if (empty($charset)) $charset = 'utf8';
41-
42-
$this->dbcon->set_charset($charset );
41+
if ($this->dbcon)
42+
$this->dbcon->set_charset($charset);
43+
4344
return $this->dbcon;
4445
}
4546

0 commit comments

Comments
 (0)