本文整理汇总了PHP中ExceptionHandler::dbexNoDatabase方法的典型用法代码示例。如果您正苦于以下问题:PHP ExceptionHandler::dbexNoDatabase方法的具体用法?PHP ExceptionHandler::dbexNoDatabase怎么用?PHP ExceptionHandler::dbexNoDatabase使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ExceptionHandler
的用法示例。
在下文中一共展示了ExceptionHandler::dbexNoDatabase方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: dbConnect
function dbConnect()
{
//$this -> conn = mysql_connect($this->myHost, $this->userName, $this->userPassword);
if (!@($this->conn = mysql_connect($this->myHost . ':' . $this->myHostPort, $this->userName, $this->userPassword))) {
$exception_handler = new ExceptionHandler();
$exception_handler->dbexNoConnection();
exit;
} else {
if ($this->conn) {
mysql_query("SET NAMES 'utf8'");
if (mysql_select_db($this->db_name)) {
return true;
} else {
$exception_handler = new ExceptionHandler();
$exception_handler->dbexNoDatabase();
exit;
}
} else {
return false;
}
}
if ($this->conn) {
mysql_select_db($this->db_name);
return true;
} else {
$exception_handler = new ExceptionHandler();
$exception_handler->dbexNoDatabase();
//exit;
return false;
}
}
示例2: dbConnect
/**
* This method will make the database connection using mysql_connect() function
* @return boolean true if connected to the database successfully
*/
public function dbConnect()
{
/*
* TODO: The capturing of database errors should be done without returning true or false; Proper exceptions
* should be thrown instead
*/
if (!@($this->conn = mysql_connect($this->myHost . ':' . $this->myHostPort, $this->userName, $this->userPassword))) {
$exception_handler = new ExceptionHandler();
$exception_handler->dbexNoConnection();
exit;
} else {
if ($this->conn) {
mysql_query("SET NAMES 'utf8'");
if (mysql_select_db($this->db_name)) {
mysql_query("SET @orangehrm_user = '{$this->orangeUser}';");
return true;
} else {
$exception_handler = new ExceptionHandler();
$exception_handler->dbexNoDatabase();
exit;
}
} else {
return false;
}
}
if ($this->conn) {
mysql_select_db($this->db_name);
mysql_query("SET @orangehrm_user = '{$this->orangeUser}';");
return true;
} else {
$exception_handler = new ExceptionHandler();
$exception_handler->dbexNoDatabase();
return false;
}
}