本文整理汇总了PHP中mydb::_connection方法的典型用法代码示例。如果您正苦于以下问题:PHP mydb::_connection方法的具体用法?PHP mydb::_connection怎么用?PHP mydb::_connection使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mydb
的用法示例。
在下文中一共展示了mydb::_connection方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: cxn
public static function cxn()
{
if (!self::$_connection) {
/*********************************************************************/
/*************<< Specify the LIVE dB or the DEV dB >>*****************/
/*********************************************************************/
//$mode = $_SESSION['production_mode']; // Either "live" or "dev", defined in "includes/constants.php"
$mode = "live";
switch ($mode) {
case "live":
$host = "raprecsiskiyou.db.4665018.hostedresource.com";
// LIVE
$user = "raprecsiskiyou";
// LIVE
$passwd = "Tr1ckyStats";
// LIVE
$database = "raprecsiskiyou";
// LIVE
$port = 65536;
// LIVE
break;
case "amazon":
$host = "aatn7x1ex5ss96.cxttuzijpd1s.us-west-2.rds.amazonaws.com:3306";
// LIVE
$user = "raprecsiskiyou";
// LIVE
$passwd = "Tr1ckyStats";
// LIVE
$database = "raprecsiskiyou";
// LIVE
$port = 3306;
// LIVE
break;
case "dev":
default:
$host = "localhost";
// DEV
//$host = "127.0.0.1"; // DEV
$user = "raprecsiskiyou";
// DEV
$passwd = "Tr1ckyStats";
// DEV
$database = "raprecsiskiyou";
// DEV
break;
}
//end switch
// Using mysqli (PHP 5)
self::$_connection = new mysqli($host, $user, $passwd, $database);
/* Check Connection */
if (self::$_connection->connect_error) {
printf("Database connect failed: %s\n", mysqli_connect_error());
exit;
}
}
return self::$_connection;
}
示例2: cxn
public static function cxn()
{
if (!self::$_connection) {
/*********************************************************************/
/*************<< Specify the LIVE dB or the DEV dB >>*****************/
/*********************************************************************/
$mode = 2;
// 1 = LIVE, 2 = DEV
switch ($mode) {
case 1:
$host = "siskiyou_general.db.4665018.hostedresource.com";
// LIVE
$user = "siskiyou_general";
// LIVE
$passwd = "Siskiyou09";
// LIVE
$database = "siskiyou_general";
// LIVE
$port = 65536;
// LIVE
break;
case 2:
default:
$host = "localhost";
// DEV
$user = "siskiyou_general";
// DEV
$passwd = "Siskiyou09";
// DEV
$database = "siskiyou_general";
// DEV
break;
}
//end switch
// Using mysqli (PHP 5)
self::$_connection = new mysqli($host, $user, $passwd, $database);
/* Check Connection */
if (self::$_connection->connect_error) {
printf("Database connect failed: %s\n", mysqli_connect_error());
exit;
}
}
return self::$_connection;
}