/** * @param string $host * @param string $username * @param string $password * @param string $db * @param int $port */ public function __construct($host, $username, $password, $db, $port = NULL) { if ($port == NULL) { $port = ini_get('mysqli.default_port'); } $this->_mysqli = new mysqli($host, $username, $password, $db, $port) or die('There was a problem connecting to the database'); $this->_mysqli->set_charset('utf8'); self::$_instance = $this; }
/** * @param string $host * @param string $username * @param string $password * @param string $db * @param int $port */ public function __construct($port = NULL) { if ($port == NULL) { $this->port = ini_get('mysqli.default_port'); } else { $this->port = $port; } $this->connect(); $this->setPrefix(); self::$_instance = $this; }
/** * @param string $host * @param string $username * @param string $password * @param string $db * @param int $port */ public function __construct($host = NULL, $username = NULL, $password = NULL, $db = NULL, $port = NULL, $charset = 'utf8') { $isSubQuery = false; // if params were passed as array if (is_array($host)) { foreach ($host as $key => $val) { ${$key} = $val; } } // if host were set as mysqli socket if (is_object($host)) { $this->_mysqli = $host; } else { $this->host = $host; } $this->username = $username; $this->password = $password; $this->db = $db; $this->port = $port; $this->charset = $charset; if ($isSubQuery) { $this->isSubQuery = true; return; } if (isset($prefix)) { $this->setPrefix($prefix); } self::$_instance = $this; }
/** * @param string $host * @param string $username * @param string $password * @param string $db * @param int $port */ public function __construct($host = NULL, $username = NULL, $password = NULL, $db = NULL, $port = NULL, $charset = 'utf8') { $isSubQuery = false; // if params were passed as array if (is_array($host)) { foreach ($host as $key => $val) { ${$key} = $val; } } // if host were set as mysqli socket if (is_object($host)) { $this->_mysqli = $host; } else { $this->host = $host; } $this->username = $username; $this->password = $password; $this->db = $db; $this->port = $port; $this->charset = $charset; if ($isSubQuery) { $this->isSubQuery = true; return; } // for subqueries we do not need database connection and redefine root instance $connected = false; if (!is_object($host)) { if ($this->connect() === true) { $connected = true; } } // check connection if ($connected === false) { throw new \Exception("Unable to connect to the database. Access denied or incorrect parameters."); } $this->setPrefix(); self::$_instance = $this; }
/** * @param string $host * @param string $username * @param string $password * @param string $db * @param int $port */ public function __construct($host = NULL, $username = NULL, $password = NULL, $db = NULL, $port = NULL) { $this->host = $host; $this->username = $username; $this->password = $password; $this->db = $db; if ($port == NULL) { $this->port = ini_get('mysqli.default_port'); } else { $this->port = $port; } if ($host == null && $username == null && $db == null) { $this->isSubQuery = true; return; } // for subqueries we do not need database connection and redefine root instance $this->connect(); $this->setPrefix(); self::$_instance = $this; }
/** * @param string $host * @param string $username * @param string $password * @param string $db * @param int $port */ public function __construct($host = NULL, $username = NULL, $password = NULL, $db = NULL, $port = NULL) { $this->setPrefix(); self::$_instance = $this; }
/** * @param string $host * @param string $username * @param string $password * @param string $db * @param int $port */ public function __construct($host, $username, $password, $db, $port = NULL) { $this->host = $host; $this->username = $username; $this->password = $password; $this->db = $db; if ($port == NULL) { $this->port = ini_get('mysqli.default_port'); } else { $this->port = $port; } $this->connect(); $this->setPrefix(); self::$_instance = $this; }
/** * @param string $host * @param string $username * @param string $password * @param string $db * @param int $port */ public function __construct($host = NULL, $username = NULL, $password = NULL, $db = NULL, $port = NULL, $charset = 'utf8') { $isSubQuery = false; // if params were passed as array if (is_array($host)) { foreach ($host as $key => $val) { ${$key} = $val; } } // if host were set as mysqli socket if (is_object($host)) { $this->_mysqli = $host; } else { $this->host = $host; } $this->username = $username; $this->password = $password; $this->db = $db; $this->port = $port; $this->charset = $charset; if ($isSubQuery) { $this->isSubQuery = true; return; } // for subqueries we do not need database connection and redefine root instance if (!is_object($host)) { $this->connect(); } $this->setPrefix(); self::$_instance = $this; }
public function __construct($host = '192.185.4.175', $username = '******', $password = '******', $db = 'arielces_desarrollos', $port = NULL) { // public function __construct($host = 'localhost', $username = '******', $password = '******', $db = 'ac_desarrollos', $port = NULL) { $this->host = $host; $this->username = $username; $this->password = $password; $this->db = $db; if ($port == NULL) { $this->port = ini_get('mysqli.default_port'); } else { $this->port = $port; } if ($host == null && $username == null && $db == null) { $this->isSubQuery = true; return; } // for subqueries we do not need database connection and redefine root instance $this->connect(); $this->setPrefix(); self::$_instance = $this; }