public function open() { // perform a number of fatality checks, then return gracefully if (!function_exists('mysql_connect')) { $this->errorNum = 1; $this->errorMsg = 'The MySQL adapter "mysql" is not available.'; return; } if (!($this->resource = @mysql_connect($this->host, $this->user, $this->password, true))) { $this->errorNum = 2; $this->errorMsg = 'Could not connect to MySQL'; return; } parent::open(); $this->select($this->database); }
public function open() { if ($this->connected()) { return; } else { $this->close(); } // perform a number of fatality checks, then return gracefully if (!function_exists('mysql_connect')) { $this->errorNum = 1; $this->errorMsg = 'The MySQL adapter "mysql" is not available.'; return; } if (!($this->connection = @mysql_connect($this->host, $this->user, $this->password, true))) { $this->errorNum = 2; $this->errorMsg = 'Could not connect to MySQL'; return; } // Set sql_mode to non_strict mode mysql_query("SET @@SESSION.sql_mode = '';", $this->connection); parent::open(); // If auto-select is enabled select the given database. if ($this->selectDatabase && !empty($this->_database)) { $this->select($this->_database); } $this->setUTF(); }