php - mysql_select_db returns false -
there working website, today error:
access denied user 'username'@'' database 'databasename'
it doesn't show hostname. why?
i sure mysql_pconnect works correctly, mysql_select_db doesnot.
function connect() { $this->connectionid=mysql_pconnect($this->server.(!empty($this->post) ? ":".$this->post : ""), $this->username, $this->password); if ($this->connectionid === false) { exit("core module error: mysql error: ".mysql_error($this->connectionid)); } if (mysql_set_charset("utf8", $this->connectionid) !== true) { // windows bug detected: can't initaliaze charset cp1251, try force setup $this->query("set names 'utf8'", $this->connectionid); $this->query("set character set 'utf8'", $this->connectionid); $this->query("set @@collation_connection = utf8_general_ci", $this->connectionid); } if (mysql_select_db($this->db, $this->connectionid) === false) { //error here exit("core module error: mysql error: ".mysql_error($this->connectionid)); } return true; }
Comments
Post a Comment