• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP mssql_select_db函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中mssql_select_db函数的典型用法代码示例。如果您正苦于以下问题:PHP mssql_select_db函数的具体用法?PHP mssql_select_db怎么用?PHP mssql_select_db使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



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

示例1: connect

 /**
 +----------------------------------------------------------
 * 连接数据库方法
 +----------------------------------------------------------
 * @access public
 +----------------------------------------------------------
 * @throws ThinkExecption
 +----------------------------------------------------------
 */
 public function connect($config = '', $linkNum = 0)
 {
     if (!isset($this->linkID[$linkNum])) {
         if (empty($config)) {
             $config = $this->config;
         }
         $conn = $this->pconnect ? 'mssql_pconnect' : 'mssql_connect';
         // 处理不带端口号的socket连接情况
         $host = $config['hostname'] . ($config['hostport'] ? ":{$config['hostport']}" : '');
         $this->linkID[$linkNum] = $conn($host, $config['username'], $config['password']);
         if (!$this->linkID[$linkNum]) {
             throw_exception($this->error());
             return false;
         }
         if (!mssql_select_db($config['database'], $this->linkID[$linkNum])) {
             throw_exception($this->error());
             return false;
         }
         // 标记连接成功
         $this->connected = true;
         //注销数据库安全信息
         if (1 != C('DB_DEPLOY_TYPE')) {
             unset($this->config);
         }
     }
     return $this->linkID[$linkNum];
 }
开发者ID:dalinhuang,项目名称:concourse,代码行数:36,代码来源:DbMssql.class.php


示例2: select

 function select($db)
 {
     if (FALSE == mssql_select_db($db)) {
         $this->print_error("<ol><b>Error establishing a database connection!</b><li>Are you sure you have the correct user/password?<li>Are you sure that you have typed the correct hostname?<li>Are you sure that the database server is running?</ol>");
         die;
     }
 }
开发者ID:benvanstaveren,项目名称:movabletype,代码行数:7,代码来源:ezsql_mssqlserver.php


示例3: sql_connect

 /**
  * Connect to server
  */
 function sql_connect($sqlserver, $sqluser, $sqlpassword, $database, $port = false, $persistency = false, $new_link = false)
 {
     if (!function_exists('mssql_connect')) {
         $this->connect_error = 'mssql_connect function does not exist, is mssql extension installed?';
         return $this->sql_error('');
     }
     $this->persistency = $persistency;
     $this->user = $sqluser;
     $this->dbname = $database;
     $port_delimiter = defined('PHP_OS') && substr(PHP_OS, 0, 3) === 'WIN' ? ',' : ':';
     $this->server = $sqlserver . ($port ? $port_delimiter . $port : '');
     @ini_set('mssql.charset', 'UTF-8');
     @ini_set('mssql.textlimit', 2147483647);
     @ini_set('mssql.textsize', 2147483647);
     if (version_compare(PHP_VERSION, '5.1.0', '>=') || version_compare(PHP_VERSION, '5.0.0-dev', '<=') && version_compare(PHP_VERSION, '4.4.1', '>=')) {
         $this->db_connect_id = $this->persistency ? @mssql_pconnect($this->server, $this->user, $sqlpassword, $new_link) : @mssql_connect($this->server, $this->user, $sqlpassword, $new_link);
     } else {
         $this->db_connect_id = $this->persistency ? @mssql_pconnect($this->server, $this->user, $sqlpassword) : @mssql_connect($this->server, $this->user, $sqlpassword);
     }
     if ($this->db_connect_id && $this->dbname != '') {
         if (!@mssql_select_db($this->dbname, $this->db_connect_id)) {
             @mssql_close($this->db_connect_id);
             return false;
         }
     }
     return $this->db_connect_id ? $this->db_connect_id : $this->sql_error('');
 }
开发者ID:eyumay,项目名称:ju.ejhs,代码行数:30,代码来源:mssql.php


示例4: connect

 /**
  * {@inheritdoc}
  */
 public function connect()
 {
     $config = $this->config;
     $config = array_merge($this->baseConfig, $config);
     $os = env('OS');
     if (!empty($os) && strpos($os, 'Windows') !== false) {
         $sep = ',';
     } else {
         $sep = ':';
     }
     $this->connected = false;
     if (is_numeric($config['port'])) {
         $port = $sep . $config['port'];
         // Port number
     } elseif ($config['port'] === null) {
         $port = '';
         // No port - SQL Server 2005
     } else {
         $port = '\\' . $config['port'];
         // Named pipe
     }
     if (!$config['persistent']) {
         $this->connection = mssql_connect($config['host'] . $port, $config['username'], $config['password'], true);
     } else {
         $this->connection = mssql_pconnect($config['host'] . $port, $config['username'], $config['password']);
     }
     if (mssql_select_db($config['database'], $this->connection)) {
         $this->qery('SET DATEFORMAT ymd');
         $this->connected = true;
     }
     return $this->connection;
 }
开发者ID:speedwork,项目名称:database,代码行数:35,代码来源:MssqlDriver.php


示例5: _connect

 /**
  * Creates a connection resource.
  */
 protected function _connect()
 {
     if (is_resource($this->_connection)) {
         // connection already exists
         return;
     }
     if (!extension_loaded('mssql')) {
         throw new Exception('The mssql extension is required for this adapter but the extension is not loaded');
     }
     $serverName = $this->_config['host'];
     if (isset($this->_config['port'])) {
         $port = (int) $this->_config['port'];
         $serverName .= ', ' . $port;
     }
     $username = $password = '';
     if (isset($this->_config['username']) && isset($this->_config['password'])) {
         $username = $this->_config['username'];
         $password = $this->_config['password'];
     }
     $this->_connection = mssql_connect($serverName, $username, $password);
     if (!$this->_connection) {
         throw new Exception('Mssql Connection Error: ' . mssql_get_last_message());
     }
     if (isset($this->_config['dbname']) && !mssql_select_db($this->_config['dbname'])) {
         throw new Exception('Unable to connect or select database ' . $this->_config['dbname']);
     }
 }
开发者ID:diglin,项目名称:diglin_mssql,代码行数:30,代码来源:Mssql.php


示例6: __construct

 /**
  * Constructor 
  * 
  * @param $dsn string DSN for the connection
  */
 public function __construct($dsn)
 {
     $this->config = parse_url($dsn);
     if (!$this->config) {
         throw new DatabaseException("Invalid dsn '{$dsn}'.");
     }
     $database = trim($this->config['path'], '/');
     if (isset($this->config['host'])) {
         $host = $this->config['host'];
     }
     if (isset($this->config['user'])) {
         $user = $this->config['user'];
     }
     if (isset($this->config['port'])) {
         $port = $this->config['port'];
     }
     if (isset($this->config['pass'])) {
         $pass = $this->config['pass'];
     }
     $this->connection = mssql_connect($host, $user, $pass);
     if (!$this->connection) {
         throw new DatabaseException("Invalid database settings.");
     }
     if (!mssql_select_db($database, $this->connection)) {
         throw new DatabaseException("Database does not exist");
     }
 }
开发者ID:jawngee,项目名称:HeavyMetal,代码行数:32,代码来源:mssql.php


示例7: getProductos

function getProductos()
{
    $myServer = "172.30.5.49";
    $myUser = "UsrPsg";
    $myPass = "PsGcRm1402*LaU+";
    $myDB = "LAUMAYER";
    $dbhandle = mssql_connect($myServer, $myUser, $myPass) or die("Couldn't connect to SQL Server on {$myServer}");
    $selected = mssql_select_db($myDB, $dbhandle) or die("Couldn't open database {$myDB}");
    //Realiza el query en la base de datos
    $mysqli = makeSqlConnection();
    //$sql = "SELECT * FROM psg_productos a LEFT JOIN psg_productos_cstm ac ON a.id = ac.id_c";
    $sql = "SELECT id,name FROM psg_productos where deleted ='0'";
    $res = $mysqli->query($sql);
    $rows = array();
    while ($r = mysqli_fetch_assoc($res)) {
        $obj = (object) $r;
        $querySaldo = "Select dbo.F_Saldo_Bodega_Informe(Year(GETDATE()),MONTH(GETDATE()),'" . $r['id'] . "','BODPRDCTO','T','C') as Saldo";
        $result = mssql_query($querySaldo);
        if ($row = mssql_fetch_array($result)) {
            $obj->saldo = $row['Saldo'];
        }
        $a = (array) $obj;
        $rows[] = $a;
    }
    mssql_close($dbhandle);
    if (empty($rows)) {
        return '{"results" :[]}';
    } else {
        //Convierte el arreglo en json y lo retorna
        $temp = json_encode(utf8ize($rows));
        return '{"results" :' . $temp . '}';
    }
}
开发者ID:ekutor,项目名称:hermes,代码行数:33,代码来源:getProductos.php


示例8: conn

function conn($DB)
{
    $serverName = "intelisis";
    //serverName\instanceName
    $connectionInfo = array("Database" => $DB, "UID" => "intelisis", "PWD" => "");
    $conn = mssql_connect($serverName, "intelisis", "");
    mssql_select_db($DB, $conn);
    $user = $_SESSION["user"];
    if (!$conn) {
        die('Something went wrong while connecting to MSSQL');
    }
    $con1 = "set dateformat dmy";
    $con1 = mssql_query($con1);
    $con2 = "SET DATEFIRST 7";
    $con2 = mssql_query($con2);
    $con3 = "SET ANSI_NULLS OFF";
    $con3 = mssql_query($con3);
    $con4 = "SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED";
    $con4 = mssql_query($con4);
    $con5 = "SET LOCK_TIMEOUT -1";
    $con5 = mssql_query($con5);
    $con6 = "SET QUOTED_IDENTIFIER OFF";
    $con6 = mssql_query($con6);
    $con7 = "set language spanish";
    $con7 = mssql_query($con7);
}
开发者ID:Bragiel,项目名称:apmovilprueba,代码行数:26,代码来源:pedidosesp_func.php


示例9: connect

 public function connect()
 {
     if ($this->conn_id && $this->state == self::OPEN) {
         mssql_select_db($this->getDatabase(), $this->conn_id);
         return true;
     }
     //TODO preConnect actions should be called from here
     $hostString = $this->getHost();
     if ($this->getPort() != '') {
         $hostString .= ':' . $this->getPort();
     }
     if (isset($this->options['socket']) && $this->options['socket'] != '') {
         $hostString .= ':' . $this->options['socket'];
     }
     $flags = isset($this->options['flags']) ? $this->options['flags'] : null;
     if (isset($this->options['persistent']) && $this->options['persistent'] == true) {
         $this->conn_id = @mssql_pconnect($hostString, $this->getUser(), $this->getPassword(), $flags);
     } else {
         $this->conn_id = @mssql_connect($hostString, $this->getUser(), $this->getPassword(), $flags);
     }
     if (!$this->conn_id) {
         $this->state = self::CLOSED;
         $msg = '[!Database connection error!]: ' . $this->getDatabase() . ' - ' . $this->getErrorMsg();
         PhpBURN_Message::output($msg, PhpBURN_Message::ERROR);
         return false;
     }
     //Selecting database
     mssql_select_db($this->getDatabase(), $this->conn_id);
     $this->state = self::OPEN;
     //TODO onConnectSucess actions should be called from here
     return true;
 }
开发者ID:phpburn,项目名称:phpburn,代码行数:32,代码来源:PDO_MSSQL.php


示例10: Open

function Open($dbType, $connectType = "c", $connect, $username = "", $password = "", $dbName)
{
    switch ($dbType) {
        case "mssql":
            if ($connectType == "c") {
                $idCon = mssql_connect($connect, $username, $password);
            } else {
                $idCon = mssql_pconnect($connect, $username, $password);
            }
            mssql_select_db($dbName);
            break;
        case "mysql":
            if ($connectType == "c") {
                $idCon = @mysql_connect($connect, $username, $password);
            } else {
                $idCon = @mysql_pconnect($connect, $username, $password);
            }
            $idCon1 = mysql_select_db($dbName, $idCon);
            break;
        case "pg":
            if ($connectType == "c") {
                $idCon = pg_connect($connect . " user=" . $username . " password=" . $password . " dbname=" . $dbName);
            } else {
                $idCon = pg_pconnect($connect . " user=" . $username . " password=" . $password . " dbname=" . $dbName);
            }
            break;
        default:
            $idCon = 0;
            break;
    }
    return $idCon;
}
开发者ID:laiello,项目名称:ebpls,代码行数:32,代码来源:multidbconnection.php


示例11: Connect

 /**
  * @return bool
  */
 function Connect()
 {
     //if ($this->_conectionHandle != false) return true;
     if (!extension_loaded('mssql')) {
         $this->ErrorDesc = 'Can\'t load MsSQL extension.';
         setGlobalError($this->ErrorDesc);
         $this->_log->WriteLine($this->ErrorDesc);
         return false;
     }
     $ti = getmicrotime();
     $this->_conectionHandle = @mssql_connect($this->_host, $this->_user, $this->_password);
     $this->_log->WriteLine('>> CONNECT TIME - ' . (getmicrotime() - $ti));
     if ($this->_conectionHandle) {
         if (strlen($this->_dbName) > 0) {
             $dbselect = @mssql_select_db($this->_dbName, $this->_conectionHandle);
             if (!$dbselect) {
                 $this->_setSqlError();
                 $this->_conectionHandle = $dbselect;
                 @mssql_close($this->_conectionHandle);
                 return false;
             }
         }
         return true;
     } else {
         $this->_setSqlError();
         return false;
     }
 }
开发者ID:diedsmiling,项目名称:busenika,代码行数:31,代码来源:class_dbmssql.php


示例12: get_web_log

 public function get_web_log()
 {
     //select the database
     mssql_select_db($this->dbname, $this->dbcon);
     //SQL Select statement
     $xml = new XMLHandler(XML_DIR . "web_request_spk.xml");
     $sql_from_xml = $xml->getNode("web_log");
     $sqlselect = str_replace("FILTER_BY_PROGRAM", "", $sql_from_xml);
     //Run the SQL query
     $result = mssql_query($sqlselect);
     $numfields = mssql_num_fields($result);
     $string_result = "";
     while ($row = mssql_fetch_row($result)) {
         $string_result .= "<tr>";
         for ($i = 0; $i < $numfields; $i++) {
             if (mssql_field_name($result, $i) == "IP_ADDRESS") {
                 $ip = explode(":", $row[$i]);
                 $string_result .= "<td>" . $ip[0] . "</td>";
                 $string_result .= "<td>" . $ip[1] . "</td>";
             } else {
                 $string_result .= "<td>" . $row[$i] . "</td>";
             }
         }
         $string_result .= "</tr>";
     }
     return $string_result;
 }
开发者ID:edosatriani,项目名称:greensys,代码行数:27,代码来源:web_log_Model.php


示例13: connect

 /**
  * Make the connection
  *
  * @return return connection
  */
 public function connect()
 {
     // Check if link already exists
     if (is_resource($this->link)) {
         return $this->link;
     }
     // Import the connect variables
     extract($this->db_config['connection']);
     // Persistent connections enabled?
     $connect = $this->db_config['persistent'] == TRUE ? 'mssql_pconnect' : 'mssql_connect';
     // Build the connection info
     $host = isset($host) ? $host : $socket;
     // Windows uses a comma instead of a colon
     $port = (isset($port) and is_string($port)) ? (KOHANA_IS_WIN ? ',' : ':') . $port : '';
     // Make the connection and select the database
     if ($this->link = $connect($host . $port, $user, $pass, TRUE) and mssql_select_db($database, $this->link)) {
         /* This is being removed so I can use it, will need to come up with a more elegant workaround in the future...
         		 *
         		 if ($charset = $this->db_config['character_set'])
         		 {
         			$this->set_charset($charset);
         			}
         			*/
         // Clear password after successful connect
         $this->config['connection']['pass'] = NULL;
         return $this->link;
     }
     return FALSE;
 }
开发者ID:kjgarza,项目名称:ushahidi,代码行数:34,代码来源:Mssql.php


示例14: reconnect

 function reconnect()
 {
     global $gbl, $sgbl, $login, $ghtml;
     $this->__readserver = 'localhost';
     $user = $sgbl->__var_admin_user;
     $db = $sgbl->__var_dbf;
     $pass = getAdminDbPass();
     $readserver = $this->__readserver;
     $fdbvar = "__fdb_" . $this->__readserver;
     log_log("database_reconnect", "Reconnecting again");
     if ($sgbl->__var_database_type === 'mysql') {
         $gbl->{$fdbvar} = mysql_connect($readserver, $user, $pass);
         mysql_select_db($db);
         self::$__database = 'mysql';
     } else {
         if ($sgbl->__var_database_type === 'mssql') {
             //print("$user, $pass <br> \n");
             //$gbl->$fdbvar = mssql_connect('\\.\pipe\MSSQL$LXLABS\sql\query');
             $gbl->{$fdbvar} = mssql_pconnect("{$readserver},{$sgbl->__var_mssqlport}");
             mssql_select_db($db);
             self::$__database = 'mssql';
         } else {
             $gbl->{$fdbvar} = new PDO("sqlite:{$db}");
             self::$__database = 'sqlite';
         }
     }
 }
开发者ID:lonelywoolf,项目名称:hypervm,代码行数:27,代码来源:sqlite.php


示例15: __construct

 function __construct()
 {
     // Load Configuration for this Module
     global $configArray;
     $this->hipUrl = $configArray['Catalog']['hipUrl'];
     $this->hipProfile = $configArray['Catalog']['hipProfile'];
     $this->selfRegProfile = $configArray['Catalog']['selfRegProfile'];
     // Connect to database
     if (!isset($configArray['Catalog']['useDb']) || $configArray['Catalog']['useDb'] == true) {
         try {
             if (strcasecmp($configArray['System']['operatingSystem'], 'windows') == 0) {
                 sybase_min_client_severity(11);
                 $this->db = @sybase_connect($configArray['Catalog']['database'], $configArray['Catalog']['username'], $configArray['Catalog']['password']);
             } else {
                 $this->db = mssql_connect($configArray['Catalog']['host'] . ':' . $configArray['Catalog']['port'], $configArray['Catalog']['username'], $configArray['Catalog']['password']);
                 // Select the database
                 mssql_select_db($configArray['Catalog']['database']);
             }
         } catch (Exception $e) {
             global $logger;
             $logger->log("Could not load Horizon database", PEAR_LOG_ERR);
         }
     } else {
         $this->useDb = false;
     }
 }
开发者ID:victorfcm,项目名称:VuFind-Plus,代码行数:26,代码来源:Horizon.php


示例16: connect

 /**
  * 连接数据库方法
  * @access public
  */
 public function connect($config = '', $linkNum = 0)
 {
     if (!isset($this->linkID[$linkNum])) {
         if (empty($config)) {
             $config = $this->config;
         }
         $pconnect = !empty($config['params']['persist']) ? $config['params']['persist'] : $this->pconnect;
         $conn = $pconnect ? 'mssql_pconnect' : 'mssql_connect';
         // 处理不带端口号的socket连接情况
         $sepr = IS_WIN ? ',' : ':';
         $host = $config['hostname'] . ($config['hostport'] ? $sepr . "{$config['hostport']}" : '');
         $this->linkID[$linkNum] = $conn($host, $config['username'], $config['password']);
         if (!$this->linkID[$linkNum]) {
             throw_exception("Couldn't connect to SQL Server on {$host}");
         }
         if (!empty($config['database']) && !mssql_select_db($config['database'], $this->linkID[$linkNum])) {
             throw_exception("Couldn't open database '" . $config['database']);
         }
         // 标记连接成功
         $this->connected = true;
         //注销数据库安全信息
         if (1 != C('DB_DEPLOY_TYPE')) {
             unset($this->config);
         }
     }
     return $this->linkID[$linkNum];
 }
开发者ID:wjgjb1109,项目名称:huicms,代码行数:31,代码来源:DbMssql.class.php


示例17: sql_db

 function sql_db($sqlserver, $sqluser, $sqlpassword, $database, $persistency = true)
 {
     $mtime = microtime();
     $mtime = explode(" ", $mtime);
     $mtime = $mtime[1] + $mtime[0];
     $starttime = $mtime;
     $this->persistency = $persistency;
     $this->user = $sqluser;
     $this->password = $sqlpassword;
     $this->server = $sqlserver;
     $this->dbname = $database;
     $this->db_connect_id = $this->persistency ? @mssql_pconnect($this->server, $this->user, $this->password) : @mssql_connect($this->server, $this->user, $this->password);
     if ($this->db_connect_id && $this->dbname != "") {
         if (!mssql_select_db($this->dbname, $this->db_connect_id)) {
             mssql_close($this->db_connect_id);
             $mtime = microtime();
             $mtime = explode(" ", $mtime);
             $mtime = $mtime[1] + $mtime[0];
             $endtime = $mtime;
             $this->sql_time += $endtime - $starttime;
             return false;
         }
     }
     $mtime = microtime();
     $mtime = explode(" ", $mtime);
     $mtime = $mtime[1] + $mtime[0];
     $endtime = $mtime;
     $this->sql_time += $endtime - $starttime;
     return $this->db_connect_id;
 }
开发者ID:BackupTheBerlios,项目名称:phpbbsfp,代码行数:30,代码来源:mssql.php


示例18: connect

 /** db::connect
  * Connects to a MySQL server, then selects the database.
  * This function will halt execution if it fails.
  * @param Server URL
  * @param SQL User name
  * @param SQL Password
  * @param Database to select from
  */
 function connect($dbURL, $dbUserName, $dbPassword, $dbDatabase)
 {
     // Don't connect if we don't specify a URL
     if (!$dbURL) {
         return false;
     }
     // Attempt connection to SQl database
     if ($this->mode == 'mysql') {
         $this->link = mysql_connect($dbURL, $dbUserName, $dbPassword);
     }
     if ($this->mode == 'mssql') {
         $this->link = mssql_connect($dbURL, $dbUserName, $dbPassword);
     }
     // Check for link failure, Stop execution if connection fails
     if (!$this->link) {
         die("Could not connect to database at " . $dbURL . ".<br>Reason: " . mysql_error());
     }
     // Try to select the database
     if ($this->mode == 'mysql') {
         if (!mysql_select_db($dbDatabase, $this->link)) {
             die("Failed to select database '" . $dbDatabase . "'<br>Reason: " . mysql_error());
         }
     }
     if ($this->mode == 'mssql') {
         if (!mssql_select_db($dbDatabase, $this->link)) {
             die("Failed to select database \\'" . $dbDatabase . "\\'<br>Reason: " . mysql_error());
         }
     }
     $this->connected = true;
 }
开发者ID:mwilchez,项目名称:master,代码行数:38,代码来源:db.php


示例19: dbquery_func_old

function dbquery_func_old($connection_info, $query, $debug = "off")
{
    if ($connection_info['db_type'] == "mysql") {
        mysql_connect($connection_info['db_host'] . ":" . $connection_info['db_port'], $connection_info['username'], $connection_info['password']) or die("Unable to connect to " . $connection_info['db_host']);
        mysql_select_db($connection_info['db_name']) or die("Unable to select database " . $connection_info['db_name']);
        $return = mysql_query($query);
        if ($debug == "on") {
            $merror = mysql_error();
            if (!empty($merror)) {
                print "MySQL Error:<br />" . $merror . "<p />Query<br />: " . $query . "<br />";
            }
            print "Number of rows returned: " . mysql_num_rows($return) . "<br />";
        }
    } else {
        if ($connection_info['db_type'] == "mssql") {
            mssql_connect($connection_info['db_host'] . "," . $connection_info['db_port'], $connection_info['username'], $connection_info['password']) or die("Unable to connect to " . $connection_info['db_host'] . "<br />" . $query);
            mssql_select_db($connection_info['db_name']) or die("Unable to select database " . $connection_info['db_name']);
            $return = mssql_query($query);
            if ($debug == "on") {
                $merror = mssql_get_last_message();
                if (!empty($merror)) {
                    print "MySQL Error: " . $merror . "<br />Query" . $query . "<br />";
                }
                print "Number of rows returned: " . mssql_num_rows($result) . "<br />";
            }
        }
    }
    return $return;
}
开发者ID:JhunCabas,项目名称:avarice-nms,代码行数:29,代码来源:db_config.php


示例20: sql_connect

	/**
	* Connect to server
	*/
	function sql_connect($sqlserver, $sqluser, $sqlpassword, $database, $port = false, $persistency = false, $new_link = false)
	{
		$this->persistency = $persistency;
		$this->user = $sqluser;
		$this->server = $sqlserver . (($port) ? ':' . $port : '');
		$this->dbname = $database;

		@ini_set('mssql.charset', 'UTF-8');
		@ini_set('mssql.textlimit', 2147483647);
		@ini_set('mssql.textsize', 2147483647);

		if (version_compare(PHP_VERSION, '5.1.0', '>=') || (version_compare(PHP_VERSION, '5.0.0-dev', '<=') && version_compare(PHP_VERSION, '4.4.1', '>=')))
		{
			$this->db_connect_id = ($this->persistency) ? @mssql_pconnect($this->server, $this->user, $sqlpassword, $new_link) : @mssql_connect($this->server, $this->user, $sqlpassword, $new_link);
		}
		else
		{
			$this->db_connect_id = ($this->persistency) ? @mssql_pconnect($this->server, $this->user, $sqlpassword) : @mssql_connect($this->server, $this->user, $sqlpassword);
		}

		if ($this->db_connect_id && $this->dbname != '')
		{
			if (!@mssql_select_db($this->dbname, $this->db_connect_id))
			{
				@mssql_close($this->db_connect_id);
				return false;
			}
		}

		return ($this->db_connect_id) ? $this->db_connect_id : $this->sql_error('');
	}
开发者ID:pombredanne,项目名称:ArcherSys,代码行数:34,代码来源:mssql.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP msubstr函数代码示例发布时间:2022-05-15
下一篇:
PHP mssql_rows_affected函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap