当前位置: 首页>>代码示例>>PHP>>正文


PHP mysql::select_db方法代码示例

本文整理汇总了PHP中mysql::select_db方法的典型用法代码示例。如果您正苦于以下问题:PHP mysql::select_db方法的具体用法?PHP mysql::select_db怎么用?PHP mysql::select_db使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在mysql的用法示例。


在下文中一共展示了mysql::select_db方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: __construct

 private function __construct()
 {
     //-----------需要页面显示调试信息,	注释掉下面两行即可---
     //-------------------------------------------------------
     set_error_handler(array("Core", 'appError'));
     set_exception_handler(array("Core", 'appException'));
     date_default_timezone_set("Asia/Shanghai");
     if (version_compare(PHP_VERSION, '5.4.0', '<')) {
         @set_magic_quotes_runtime(0);
         define('MAGIC_QUOTES_GPC', get_magic_quotes_gpc() ? True : False);
     }
     if (!defined('WEB_PATH')) {
         //define("WEB_PATH","D:/wamp/www/pc2.valsun.cn/");
         define("WEB_PATH", "/data/web/erpNew/pc.valsun.cn/");
     }
     include WEB_PATH . "lib/common.php";
     //加载全局配置信息
     C(include WEB_PATH . 'conf/common.php');
     include WEB_PATH . "lib/auth.php";
     //鉴权
     include WEB_PATH . "lib/authuser.class.php";
     //新鉴权
     //Auth::setAccess(include WEB_PATH.'conf/access.php');
     include WEB_PATH . "lib/log.php";
     //加载数据接口层及所需支撑
     include WEB_PATH . "lib/service/http.php";
     //网络接口
     include WEB_PATH . "lib/functions.php";
     include WEB_PATH . "lib/page.php";
     include WEB_PATH . "lib/template.php";
     //PHPLIB 的模板类
     include WEB_PATH . "lib/cache/cache.php";
     //memcache
     include WEB_PATH . "lib/PHPExcel.php";
     //PHPExcel
     //include WEB_PATH."lib/rabbitmq/rabbitmq.class.php";
     //加载语言包
     //$lang	=	WEB_PATH."lang/".C("LANG").".php";		//memcache
     if (file_exists($lang)) {
         //echo $lang;
         //C(include $lang);
     }
     if (C("DATAGATE") == "db") {
         $db = C("DB_TYPE");
         include WEB_PATH . "lib/db/" . $db . ".php";
         //db直连
         if ($db == "mysql") {
             global $dbConn;
             $db_config = C("DB_CONFIG");
             $dbConn = new mysql();
             $dbConn->connect($db_config["master1"][0], $db_config["master1"][1], $db_config["master1"][2]);
             $dbConn->select_db($db_config["master1"][4]);
         }
         if (DB_TYPE == "mongodb") {
             //.......
         }
     }
     //自动加载类
     spl_autoload_register(array('Core', 'autoload'));
 }
开发者ID:ohjack,项目名称:newErp,代码行数:60,代码来源:framework.php

示例2: process_message

function process_message($msg)
{
    echo "\n############ 信息日志开始 ###############\n";
    echo date('Y-m-d H:i:s') . "=====" . $msg->body;
    echo "\n############ 信息日志结束 ###############\n";
    //执行SQL语句
    $db_config = C("DB_CONFIG");
    $dbConn = new mysql();
    $dbConn->connect($db_config["master1"][0], $db_config["master1"][1], $db_config["master1"][2], '');
    $dbConn->select_db($db_config["master1"][4]);
    $sql = $msg->body;
    $query = $dbConn->query($sql);
    if (!$query) {
        Log::write($sql, Log::ERR);
    } else {
        echo date('Y-m-d H:i:s') . '===== [ok] ', '=====', $sql, "\n";
        //确认消费OK
        $msg->delivery_info['channel']->basic_ack($msg->delivery_info['delivery_tag']);
    }
    $dbConn->close();
    // Send a message with the string "quit" to cancel the consumer.
    if ($msg->body === 'quit') {
        $msg->delivery_info['channel']->basic_cancel($msg->delivery_info['consumer_tag']);
    }
}
开发者ID:ohjack,项目名称:newErp,代码行数:25,代码来源:notice_power_subscribe.php

示例3: reconnect

function reconnect()
{
    global $dbConn;
    if (mysql_ping()) {
        return;
    }
    $db_config = C("DB_CONFIG");
    $dbConn = new mysql();
    $dbConn->connect($db_config["master1"][0], $db_config["master1"][1], $db_config["master1"][2]);
    $dbConn->select_db($db_config["master1"][4]);
}
开发者ID:ohjack,项目名称:newErp,代码行数:11,代码来源:superorder_data_consumer.php

示例4: step3

function step3($data)
{
    if (!isset($_POST['host']) || !isset($_POST['username']) || !isset($_POST['password']) || !isset($_POST['database']) || !isset($_POST['adress'])) {
        return "Es trat ein Fehler bei der �rmittlung der Daten auf.";
    }
    $mysql = new mysql(array());
    if (!@$mysql->connect($_POST['host'], $_POST['username'], $_POST['password'])) {
        return "Es konnte keine Verbindung zum Server hergestellt werden.<br />&Uuml;berpr&uuml;fe bitte deine Angaben auf ihre Richtigkeit.<br />" . mysql_error();
    }
    if (!@$mysql->select_db($_POST['database'])) {
        return "Die gew&uuml;nschte Datenbank konnte nicht ausgew&auml;hlt werden.<br />Entweder existiert diese nicht oder der gew&auml;hlte Benutzer hat keine Zugriffsrechte.<br />" . mysql_error();
    }
    $_SESSION['install']['mysql']['host'] = $_POST['host'];
    $_SESSION['install']['mysql']['username'] = $_POST['username'];
    $_SESSION['install']['mysql']['password'] = $_POST['password'];
    $_SESSION['install']['mysql']['database'] = $_POST['database'];
    $_SESSION['install']['tic_adress'] = $_POST['adress'];
    $tables = array("gn4accounts", "gn4allianzen", "gn4cron", "gn4flottenbewegungen", "gn4forum", "gn4gnuser", "gn4incplanets", "gn4log", "gn4nachrichten", "gn4nachtwache", "gn4meta", "gn4scans", "gn4attflotten", "gn4attplanung", "gn4vars", "gn4channels");
    $mysql->query("SHOW TABLE STATUS") or die($mysql->error(__FILE__, __LINE__));
    $tableexits = array();
    while ($row = $mysql->fetch()) {
        $tableexits[$row['Name']] = 1;
    }
    echo "<div style=\"border:1px #000000 solid;width:400px;padding:3px;\"><b>Schritt 3: &Uuml;berpr&uuml;fe Tabellen</b>\n          <form action=\"\" method=\"post\"><input type=\"hidden\" name=\"step\" value=\"4\" \\>\n          <table style=\"text-align:left;\" cellspacing=\"0\" cellpadding=\"0\">\n            <tr style=\"font-weight:bold;\"><td>Tabellenname</td><td>Installieren</td></tr>";
    $showwarning = 0;
    foreach ($tables as $table) {
        if ($tableexits[$table]) {
            $color = "#800000";
            $showwarning = 1;
            $input = "<input type=\"checkbox\" name=\"check[]\" value=\"" . $table . "\" checked=\"checked\"/>";
        } else {
            $color = "#008000";
            $input = "<input type=\"checkbox\" checked=\"checked\" disabled = \"disabled\" /><input type=\"hidden\"  name=\"check[]\" value=\"" . $table . "\" />";
        }
        echo "<tr style=\"color:" . $color . "\"><td>{$table}</td><td style=\"text-align:center\">" . $input . "</td></tr>";
    }
    if ($showwarning) {
        echo "</table><br /><div style=\"text-align:left\"><b>ACHTUNG:</b> Rot makierte Tabellen existieren bereits und werden, sofern die Installation fortgesetzt wird, inklusive ihrer Daten berschrieben.</div>";
    }
    echo "<input type=\"submit\" value=\"Weiter\" /></form>\n            </div>";
    return "";
}
开发者ID:albertlast,项目名称:ticenter_tic,代码行数:42,代码来源:steps.php

示例5: openConn

function openConn()
{
    global $conn;
    $conn = new mysql();
    $conna = @mysql_connect($GLOBALS['dbhost'], $GLOBALS['dbuser'], $GLOBALS['dbpwd']);
    if (!$conna) {
        header('Location:' . $GLOBALS['webDir'] . '/phpinc/startInstall.php');
        //ֱ����ת��װҳ
        exit('<a href="' . $GLOBALS['webDir'] . '/phpinc/startInstall.php" target="_blank">���ӷ�����ʧ�ܣ��������1</a>');
    }
    if (!mysql_select_db($GLOBALS['dbname'], $conna)) {
        header('Location:' . $GLOBALS['webDir'] . '/phpinc/startInstall.php');
        //ֱ����ת��װҳ
        exit('<a href="' . $GLOBALS['webDir'] . '/phpinc/startInstall.php" target="_blank">�������ݿ�ʧ�ܣ��������2</a>');
    }
    mysql_query("set names 'utf-8'");
    //���ݿ��������
    $conn->connect($GLOBALS['dbhost'], $GLOBALS['dbuser'], $GLOBALS['dbpwd']);
    $conn->select_db($GLOBALS['dbname']);
    //$conn->select_db("phpcmsv9");
    return $conn;
}
开发者ID:313801120,项目名称:AspPhpCms,代码行数:22,代码来源:Conn.php

示例6: openConn

function openConn()
{
    global $conn;
    $conn = new mysql();
    $dbhost = 'localhost';
    $dbuser = 'root';
    $dbpwd = '123456';
    $dbname = 'phpwebdata';
    $conna = @mysql_connect($dbhost, $dbuser, $dbpwd);
    if (!$conna) {
        exit('<a href="PHP2/ImageWaterMark/Include/startInstall.php" target="_blank">连接服务器失败,点击配置</a>');
    }
    if (!mysql_select_db($dbname, $conna)) {
        exit('<a href="PHP2/ImageWaterMark/Include/startInstall.php" target="_blank">连接数据库失败,点击配置</a>');
    }
    mysql_query("set names 'gb2312'");
    //数据库输出编码
    $conn->connect($dbhost, $dbuser, $dbpwd);
    $conn->select_db($dbname);
    //$conn->select_db("phpcmsv9");
    return $conn;
}
开发者ID:313801120,项目名称:AspToPhp,代码行数:22,代码来源:Conn.php

示例7: function

$queue_name = 'dev_rabbitmq_getwhstatus_queue';
//$connection = new AMQPConnection('192.168.128.129', 5672, 'peter', 'peter','mq_vhost1');//5672是端口号,两个peter分别是用户名和密码
$channel = $connection->channel();
//$channel->exchange_declare('power', 'topic', false, false, false);
//第三个参数 true 会检测交换器是否存在 ,第4个参数 true 表示 服务器重启时,交换器依然不会消失,第5个参数false 表示 如果交换器删掉,消息通道依然生效
$channel->exchange_declare($exchange_name, 'fanout', false, false, false);
//list($queue_name, ,) =
$channel->queue_declare($queue_name, false, false, false, false);
$channel->queue_bind($queue_name, $exchange_name);
//echo ' [*] Waiting for logs. To exit press CTRL+C', "\n";
$callback = function ($msg) {
    $tableName = "om_unshipped_order";
    $db_config = C("DB_CONFIG");
    $dbConn = new mysql();
    $dbConn->connect($db_config["master1"][0], $db_config["master1"][1], $db_config["master1"][2], '');
    $dbConn->select_db($db_config["master1"][4]);
    //echo ' [x] ', json_decode($msg->body), "\n";
    //var_dump($msg->body); echo "\n";
    $data = json_decode($msg->body, true);
    //var_dump($data); echo "\n";
    $orderid = $data['originOrderId'];
    $orderStatus = $data['orderStatus'];
    $operateUserId = $data['operateUserId'];
    $operateTime = $data['operateTime'];
    $actualWeight = $data['actualWeight'];
    $tracknumber = trim($data['tracknumber']);
    $orderids = CombinePackageModel::selectAllRecordByOrderId($orderid);
    var_dump($orderid . "-------" . $orderStatus);
    echo "\n";
    if (C($orderStatus) == 2) {
        //已发货状态
开发者ID:ohjack,项目名称:newErp,代码行数:31,代码来源:get_wh_status_subscribe.php

示例8:

<?
	include "class.mysql.php";
	
	$sql = new mysql;
	
	$sql->connect ( );
	$sql->select_db ( "register" );
	
	$rResult = $sql->query ( "SELECT * FROM genre" );
	if ( $sql->num_rows ( $rResult ) > 0 )
	{
		while ( $genre = $sql->fetch_assoc ( $rResult ) )
		{
			echo $genre['genre'] . "<br>\n";
		}
	}
	
	echo "<br>SQL time: " . $sql->getSqlTime ( );
?>
开发者ID:roelvanduijnhoven,项目名称:muzieklijstjes,代码行数:19,代码来源:test.php

示例9:

<?
include "class.mysql.php";

$sql = new mysql;

$sql->connect ( "mysql", "user", "password" ); // localhost is hoogstwaarschijnlijk al goed
$sql->select_db ( "dev" );					// deze is hoogstwaarschijnlijk 'register'
$sql->query("SET NAMES utf8");
开发者ID:roelvanduijnhoven,项目名称:muzieklijstjes,代码行数:8,代码来源:db.php

示例10: __construct

 private function __construct()
 {
     //-----------需要页面显示调试信息,	注释掉下面两行即可---
     //-------------------------------------------------------
     //set_error_handler(array("Core",'appError'));
     //set_exception_handler(array("Core",'appException'));
     date_default_timezone_set("Asia/Shanghai");
     if (version_compare(PHP_VERSION, '5.4.0', '<')) {
         @set_magic_quotes_runtime(0);
         define('MAGIC_QUOTES_GPC', get_magic_quotes_gpc() ? True : False);
     }
     if (!defined('WEB_PATH')) {
         define("WEB_PATH", str_replace(DIRECTORY_SEPARATOR, '/', dirname(__FILE__)) . DIRECTORY_SEPARATOR);
     }
     include WEB_PATH . "lib/common.php";
     //加载全局配置信息
     C(include WEB_PATH . 'conf/common.php');
     C(include WEB_PATH . 'conf/default_var.php');
     //订单状态码列表定义
     include WEB_PATH . "lib/auth.php";
     //鉴权
     //include	WEB_PATH."lib/authuser.class.php";	//新鉴权
     include WEB_PATH . "lib/php-export-data.class.php";
     //excel
     //Auth::setAccess(include WEB_PATH.'conf/access.php');
     include WEB_PATH . "lib/log.php";
     include WEB_PATH . "conf/constant_order.php";
     //加载数据接口层及所需支撑
     include WEB_PATH . "lib/service/http.php";
     //网络接口
     include WEB_PATH . "lib/functions.php";
     include WEB_PATH . "lib/page.php";
     include WEB_PATH . "lib/template.php";
     //PHPLIB 的模板类
     include WEB_PATH . "lib/cache/cache.php";
     //memcache
     include WEB_PATH . "lib/productstatus.class.php";
     //加载语言包
     $lang = WEB_PATH . "lang/" . C("LANG") . ".php";
     //memcache
     if (file_exists($lang)) {
         //echo $lang;
         //C(include $lang);
     }
     if (C("DATAGATE") == "db") {
         $db = C("DB_TYPE");
         include WEB_PATH . "lib/db/" . $db . ".php";
         //db直连
         if ($db == "mysql") {
             global $dbConn;
             $db_config = C("DB_CONFIG");
             $dbConn = new mysql();
             $dbConn->connect($db_config["master1"][0], $db_config["master1"][1], $db_config["master1"][2]);
             $dbConn->select_db($db_config["master1"][4]);
         }
         if ($db == "mongodb") {
             //.......
         }
     }
     //自动加载类
     spl_autoload_register(array('Core', 'autoload'));
 }
开发者ID:bizonix,项目名称:sailvan,代码行数:62,代码来源:framework.php


注:本文中的mysql::select_db方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。