add support for custom port in database

This commit is contained in:
Nereziel
2023-11-14 13:12:26 +01:00
parent 4ecf484616
commit 3f8e5db2ae
2 changed files with 2 additions and 1 deletions

View File

@@ -1,5 +1,6 @@
<?php
define('DB_HOST', 'localhost');
define('DB_PORT', '3306');
define('DB_NAME', '');
define('DB_USER', '');
define('DB_PASS', '');

View File

@@ -4,7 +4,7 @@ class DataBase {
private $PDO;
public function __construct() {
$this->PDO = new PDO("mysql:host=".DB_HOST."; dbname=".DB_NAME, DB_USER, DB_PASS, array(PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES utf8"));
$this->PDO = new PDO("mysql:host=".DB_HOST."; port=".DB_PORT."; dbname=".DB_NAME, DB_USER, DB_PASS, array(PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES utf8"));
}
public function select($query, $bindings = []) {
$STH = $this->PDO->prepare($query);