diff --git a/src/web/php/lib/connect_db.php b/src/web/php/lib/connect_db.php index 4cf2848..f49052a 100644 --- a/src/web/php/lib/connect_db.php +++ b/src/web/php/lib/connect_db.php @@ -9,11 +9,11 @@ if ($has_file) { class DBConnector { private $mysqli, $stmt, $query, $paramTypeList, $paramValueArray; - private $db_host, $db_user, $db_passwd, $db_name; + private $db_host, $db_user, $db_passwd, $db_name, $db_port; function __construct() { - global $db_host, $db_user, $db_passwd, $db_name; + global $db_host, $db_user, $db_passwd, $db_name, $db_port; $this->stmt = null; $this->paramTypeList = ""; @@ -24,11 +24,13 @@ class DBConnector $this->db_user = $db_user; $this->db_passwd = $db_passwd; $this->db_name = $db_name; + $this->db_port = isset($db_port) ? $db_port : 3306; } else { $this->db_host = "localhost"; $this->db_user = "chocomae"; $this->db_passwd = "sEobMPuJ2A8KTfwU"; $this->db_name = "chocomae"; + $this->db_port = 3306; } } @@ -39,7 +41,7 @@ class DBConnector public function connectDB() { // connect db - $this->mysqli = new mysqli($this->db_host, $this->db_user, $this->db_passwd, $this->db_name); + $this->mysqli = new mysqli($this->db_host, $this->db_user, $this->db_passwd, $this->db_name, $this->db_port); // if ($this->mysqli->connect_error) { if (mysqli_connect_errno()) { return false; diff --git a/src/web/server/setup/NA_service_db_setting.php b/src/web/server/setup/NA_service_db_setting.php index 21689f3..0cd0052 100644 --- a/src/web/server/setup/NA_service_db_setting.php +++ b/src/web/server/setup/NA_service_db_setting.php @@ -4,5 +4,6 @@ $db_host = "localhost"; $db_user = "chocomae"; $db_passwd = "sEobMPuJ2A8KTfwU"; $db_name = "chocomae"; +$db_port = 3306; ?> \ No newline at end of file diff --git a/src/web/server/setup/connect_db.php b/src/web/server/setup/connect_db.php index e7763e7..b2ca25d 100644 --- a/src/web/server/setup/connect_db.php +++ b/src/web/server/setup/connect_db.php @@ -10,10 +10,11 @@ if($hasServiceDBSetting == true) { $db_passwd = "Fr12nds95"; $db_name = "jisangs"; } +if (!isset($db_port)) $db_port = 3306; // connect db -$db_conn = new mysqli($db_host, $db_user, $db_passwd, $db_name); +$db_conn = new mysqli($db_host, $db_user, $db_passwd, $db_name, $db_port); if ($db_conn->connect_error) { set_error_message("DB connection failed."); send_result_fail();