web: support MySQL server on non-default port; from Tomi Asp.

This commit is contained in:
David Anderson 2015-01-15 09:10:22 -08:00
parent 2b035629bd
commit c587219a5f
1 changed files with 8 additions and 1 deletions

View File

@ -42,7 +42,14 @@ if (parse_bool(get_config(), "no_mysqli")) {
if (MYSQLI) {
function _mysql_connect($host, $user, $pass, $dbname) {
global $mysqli;
$mysqli = new mysqli($host, $user, $pass, $dbname);
$x = explode(":", $host);
if (sizeof($x)>1) {
$host = $x[0];
$port = $x[1];
} else {
$port = null;
}
$mysqli = new mysqli($host, $user, $pass, $dbname, $port);
return $mysqli;
}
function _mysql_query($q) {