// Add support of different mysql port for mysqli and pdo

This commit is contained in:
rMalie
2012-02-02 13:50:27 +00:00
parent 71f7e3f939
commit 91e038d5e1
2 changed files with 17 additions and 2 deletions
+7 -1
View File
@@ -35,7 +35,13 @@ class DbMySQLiCore extends Db
*/
public function connect()
{
$this->link = @new mysqli($this->server, $this->user, $this->password, $this->database);
if (strpos($this->server, ':') !== false)
{
list($server, $port) = explode(':', $this->server);
$this->link = @new mysqli($server, $this->user, $this->password, $this->database, $port);
}
else
$this->link = @new mysqli($this->server, $this->user, $this->password, $this->database);
// Do not use object way for error because this work bad before PHP 5.2.9
if (mysqli_connect_error())