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

PHP mysql_selectdb函数代码示例

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

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



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

示例1: _fillEmployeeHistoryTable

 private function _fillEmployeeHistoryTable($dbName)
 {
     mysql_selectdb($dbName);
     /* Get employee data from `hs_hr_employee` and `hs_hr_job_title` tables */
     $query = "SELECT a.`emp_number` , a.`job_title_code` , a.`joined_date` , b.`jobtit_name` FROM hs_hr_employee a, hs_hr_job_title b WHERE a.`job_title_code` IS NOT NULL AND a.`job_title_code` = b.`jobtit_code`";
     $result = mysql_query($query);
     if (mysql_num_rows($result) > 0) {
         while ($row = mysql_fetch_array($result)) {
             if (isset($insertSqlSub)) {
                 $insertSqlSub = $insertSqlSub . ' , ' . '(' . "'" . $row['emp_number'] . "'" . ' , ' . "'" . $row['job_title_code'] . "'" . ' , ' . "'" . $row['jobtit_name'] . "'" . ' , ' . "'" . $row['joined_date'] . "'" . ' ) ';
             } else {
                 $insertSqlSub = '(' . "'" . $row['emp_number'] . "'" . ' , ' . "'" . $row['job_title_code'] . "'" . ' , ' . "'" . $row['jobtit_name'] . "'" . ' , ' . "'" . $row['joined_date'] . "'" . ' ) ';
             }
         }
         /* Insert data to hs_hr_emp_jobtitle_history table  */
         $insqrtSql = "INSERT INTO hs_hr_emp_jobtitle_history (`emp_number` , `code` , `name` , `start_date`) VALUES {$insertSqlSub}";
         if (!mysql_query($insqrtSql)) {
             $this->errorArray[] = "Filling Employee History table failed";
             return false;
         }
         return true;
     } else {
         return true;
     }
 }
开发者ID:noikiy,项目名称:owaspbwa,代码行数:25,代码来源:Upgrade23To242.php


示例2: initialize

 private function initialize()
 {
     $this->_ensureModuleExistance();
     /* Initializes link to MySql */
     $this->link = mysql_connect("{$this->host}:{$this->port}", $this->user, $this->pass);
     if (mysql_error($this->link)) {
         throw new WURFL_Storage_Exception("Couldn't link to {$this->host} (" . mysql_error($this->link) . ")");
     }
     /* Initializes link to database */
     $success = mysql_selectdb($this->db, $this->link);
     if (!$success) {
         throw new WURFL_Storage_Exception("Couldn't change to database {$this->db} (" . mysql_error($this->link) . ")");
     }
     /* Is Table there? */
     $test = mysql_query("SHOW TABLES FROM {$this->db} LIKE '{$this->table}'", $this->link);
     if (!is_resource($test)) {
         throw new WURFL_Storage_Exception("Couldn't show tables from database {$this->db} (" . mysql_error($this->link) . ")");
     }
     // create table if it's not there.
     if (mysql_num_rows($test) == 0) {
         $sql = "CREATE TABLE `{$this->db}`.`{$this->table}` (\r\n\t\t\t\t\t  `{$this->keycolumn}` varchar(255) collate latin1_general_ci NOT NULL,\r\n\t\t\t\t\t  `{$this->valuecolumn}` mediumblob NOT NULL,\r\n\t\t\t\t\t  `ts` timestamp NOT NULL default CURRENT_TIMESTAMP,\r\n\t\t\t\t\t  PRIMARY KEY  (`{$this->keycolumn}`)\r\n\t\t\t\t\t) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci";
         $success = mysql_query($sql, $this->link);
         if (!$success) {
             throw new WURFL_Storage_Exception("Table {$this->table} missing in {$this->db} (" . mysql_error($this->link) . ")");
         }
     }
     if (is_resource($test)) {
         mysql_free_result($test);
     }
 }
开发者ID:godboko,项目名称:modules,代码行数:30,代码来源:Mysql.php


示例3: selectDb

function selectDb($config)
{
    if (connectDb($config)) {
        return mysql_selectdb($config['db']['dbname']);
    }
    return false;
}
开发者ID:AnnaOzer,项目名称:shp-php1,代码行数:7,代码来源:dz7functionsDb.php


示例4: SelectDatabase

 function SelectDatabase($p_sDatabase)
 {
     $this->m_bFileRead = false;
     if ($this->m_oLink && strlen($p_sDatabase)) {
         if (is_dir($p_sDatabase)) {
             $this->m_oLink = 0;
             $this->m_bFileRead = true;
             $this->m_sDatabase = $p_sDatabase;
             return true;
         } else {
             if (mysql_selectdb($p_sDatabase)) {
                 $this->m_sDatabase = $p_sDatabase;
                 return true;
             } else {
                 $this->m_oLink = 0;
                 $this->m_sDatabase = "";
                 return false;
             }
         }
     } else {
         if (is_dir($p_sDatabase)) {
             $this->m_oLink = 0;
             $this->m_bFileRead = true;
             $this->m_sDatabase = $p_sDatabase;
             return true;
         } else {
             $this->m_oLink = 0;
             $this->m_sDatabase = "";
             return false;
         }
     }
 }
开发者ID:sharpplayer,项目名称:Heating,代码行数:32,代码来源:dbsession.php


示例5: init

 public function init()
 {
     define('DBPATH', 'localhost');
     define('DBUSER', 'root');
     define('DBPASS', 'root');
     define('DBNAME', 'bdpinos');
     // session_start();
     global $dbh;
     $dbh = mysql_connect(DBPATH, DBUSER, DBPASS);
     mysql_selectdb(DBNAME, $dbh);
     if ($_GET['action'] == "chatheartbeat") {
         chatHeartbeat();
     }
     if ($_GET['action'] == "sendchat") {
         sendChat();
     }
     if ($_GET['action'] == "closechat") {
         closeChat();
     }
     if ($_GET['action'] == "startchatsession") {
         startChatSession();
     }
     if (!isset($_SESSION['chatHistory'])) {
         $_SESSION['chatHistory'] = array();
     }
     if (!isset($_SESSION['openChatBoxes'])) {
         $_SESSION['openChatBoxes'] = array();
     }
 }
开发者ID:renzot23,项目名称:Los-Pinos-Virtual,代码行数:29,代码来源:Chat.php


示例6: Global_Init

function Global_Init()
{
    //session_start();
    Load_Configs();
    if (!strnatcasecmp(trim($GLOBALS['db']['type']), "LB")) {
        require_once 'inc/dbmodule_LB.php';
    }
    if (!strnatcasecmp(trim($GLOBALS['db']['type']), "GD")) {
        require_once 'inc/dbmodule_GD.php';
    }
    //echo "GLOBALS: <BR>"; print_r($GLOBALS['db']); echo "<BR>";
    $source_db_ok = SQL_DB_OK("source");
    if ($source_db_ok['error'] === false) {
        $GLOBALS['db']['s_resource'] = @mysql_connect($GLOBALS['db']['s_host'], $GLOBALS['db']['s_user'], $GLOBALS['db']['s_pass']) or die($_SERVER["SCRIPT_FILENAME"] . "Could not connect to Source MySQL Server. : " . mysql_error());
        @mysql_selectdb($GLOBALS['db']['s_base']) or die("Could not connect to Source database [" . $GLOBALS['db']['s_base'] . "] : " . mysql_error());
        $GLOBALS['db']['x_resource'] = @mysql_connect($GLOBALS['db']['x_host'], $GLOBALS['db']['x_user'], $GLOBALS['db']['x_pass']) or die($_SERVER["SCRIPT_FILENAME"] . "Could not connect to X-Ray  MySQL Server. : " . mysql_error());
        @mysql_selectdb($GLOBALS['db']['x_base']) or die("Could not connect to X-Ray database [" . $GLOBALS['db']['x_base'] . "] : " . mysql_error());
        $GLOBALS['db']['s_link'] = mysqli_connect($GLOBALS['db']['s_host'], $GLOBALS['db']['s_user'], $GLOBALS['db']['s_pass'], $GLOBALS['db']['s_base']) or die($_SERVER["SCRIPT_FILENAME"] . "Could not connect to Source MySQL Server (multilink). : " . mysqli_error($GLOBALS['db']['s_link']));
        mysqli_select_db($GLOBALS['db']['s_link'], $GLOBALS['db']['s_base']) or die("Could not connect to Source database (multilink) [" . $GLOBALS['db']['s_base'] . "] : " . mysqli_error($GLOBALS['db']['s_link']));
        $GLOBALS['db']['x_link'] = mysqli_connect($GLOBALS['db']['x_host'], $GLOBALS['db']['x_user'], $GLOBALS['db']['x_pass'], $GLOBALS['db']['x_base']) or die($_SERVER["SCRIPT_FILENAME"] . "Could not connect to X-Ray MySQL Server (multilink). : " . mysqli_error($GLOBALS['db']['x_link']));
        mysqli_select_db($GLOBALS['db']['x_link'], $GLOBALS['db']['x_base']) or die("Could not connect to X-Ray database (multilink) [" . $GLOBALS['db']['x_base'] . "] : " . mysqli_error($GLOBALS['db']['x_link']));
    } else {
        $config_error .= $source_db_ok['message'] . "<BR>";
    }
    //	array_key_exists('form', $_POST) && $_POST['form']!="" ? $_GET = $_POST : NULL;
    //	array_key_exists('force', $_GET) && $_GET['force']!="" ? $_POST = $_GET : NULL;
    if (count($_GET) > 0) {
        $_POST = $_GET;
    }
    //	if($_POST['form']!=""){$_GET = $_POST;}
    //	if($_GET['force']!=""){$_POST = $_GET;}
    if (!FixOutput_Bool($GLOBALS['config_settings']['settings']['first_setup'], true, false, true)) {
        $GLOBALS['worlds'] = Get_Worlds_Enabled();
    }
}
开发者ID:babbottscott,项目名称:X-Ray-Detective,代码行数:35,代码来源:core_xdetector.php


示例7: __construct

 function __construct()
 {
     $this->con = mysql_connect("localhost", "wemake_db", "Dsquare@123");
     if (!$this->con) {
         die('Could not connect: ' . mysql_error());
     }
     mysql_selectdb("admin", $this->con);
 }
开发者ID:EarthBug,项目名称:irksome-barnacle,代码行数:8,代码来源:db.php


示例8: connectDb

function connectDb()
{
    global $conn;
    $conn = mysql_connect(DB_HOST, DB_USER, DB_PASS) or die("can't connect to mysql=>" . mysql_error());
    mysql_selectdb(DB_NAME, $conn);
    mysql_query("SET NAMES utf8", $conn);
    //set utf8
}
开发者ID:hoangsoft90,项目名称:hack-google-ads-crx,代码行数:8,代码来源:functions.php


示例9: __construct

 function __construct()
 {
     $this->con = mysql_connect("localhost", "root", "");
     if (!$this->con) {
         die('Could not connect: ' . mysql_error());
     }
     mysql_selectdb("wemakesc_wemakescholars", $this->con);
 }
开发者ID:EarthBug,项目名称:irksome-barnacle,代码行数:8,代码来源:db.php


示例10: connectDB

function connectDB()
{
    $conn = mysql_connect('localhost', 'root', '');
    if (!$conn) {
        echo "connection failed";
    }
    mysql_selectdb('softwareProject', $conn);
    return $conn;
}
开发者ID:Vagor,项目名称:softwareProject,代码行数:9,代码来源:fun.php


示例11: dbconnect

 public function dbconnect()
 {
     global $db_username;
     global $db_password;
     global $db_database;
     global $db_host;
     $conn = mysql_connect($db_host, $db_username, $db_password);
     mysql_selectdb($db_database);
 }
开发者ID:rileyjshaw,项目名称:angelhack-2012,代码行数:9,代码来源:mysql.php


示例12: connectDB

function connectDB()
{
    $conn = mysql_connect('localhost', 'root', '123456');
    if (!$conn) {
        echo "connection failed";
    }
    mysql_selectdb('test', $conn);
    return $conn;
}
开发者ID:Vagor,项目名称:practice,代码行数:9,代码来源:fun.php


示例13: switchToEcontent

 public static function switchToEcontent()
 {
     global $configArray;
     if (!SwitchDatabase::$changedDB) {
         if (SwitchDatabase::isVuFindDatabase()) {
             mysql_selectdb($configArray['Database']['database_econtent_dbname']);
             SwitchDatabase::$changedDB = true;
         }
     }
 }
开发者ID:bryandease,项目名称:VuFind-Plus,代码行数:10,代码来源:SwitchDatabase.php


示例14: __construct

 public function __construct()
 {
     $this->db_host = "localhost";
     $this->db_db = "xing_contacts";
     $this->db_username = "xxx";
     $this->db_password = "xxx";
     mysql_connect($this->db_host, $this->db_username, $this->db_password);
     mysql_selectdb($this->db_db);
     mysql_query("INSERT INTO zugriffe (name) VALUE ('" . $_SESSION['mode'] . "')");
 }
开发者ID:rbertel,项目名称:xing_contact_manager,代码行数:10,代码来源:Zugriffe.php


示例15: connectToDB

function connectToDB()
{
    $userName = "demo";
    $password = "test";
    $server = "localhost";
    $db = mysql_connect($server, $userName, $passwork);
    if ($db != false) {
        mysql_selectdb("PushNotification");
        mysql_set_charset('utf-8');
    }
    return $db;
}
开发者ID:kaga1030,项目名称:workbook,代码行数:12,代码来源:PushNotificationDB.php


示例16: connect

 public function connect()
 {
     if (!self::$link) {
         self::$link = mysql_connect(self::$host, self::$user, self::$password);
         mysql_set_charset('UTF8');
         if (!self::$link) {
             die('mysql connect error' . mysql_error());
         }
         mysql_selectdb(self::$db, self::$link);
     }
     return self::$link;
 }
开发者ID:AmazingPoint,项目名称:hot_girl,代码行数:12,代码来源:DataBaseUtil.class.php


示例17: connectDb

function connectDb()
{
    require 'config.php';
    $db = mysql_connect($cfg['dbServer'], $cfg['dbuser'], $cfg['dbpass']);
    if ($db === false) {
        die("Can't connect to database");
    }
    if (mysql_selectdb($cfg['dbname'], $db) === false) {
        die("Can't connect to database");
    }
    mysql_query("SET NAMES utf8");
    return $db;
}
开发者ID:batnyam,项目名称:shop,代码行数:13,代码来源:db.php


示例18: __construct

 public function __construct($host, $username, $password, $database, $storage)
 {
     if (!mysql_selectdb($database, mysql_connect($host, $username, $password))) {
         die('Database connection failed.');
     } elseif ($this->caching) {
         if (!is_dir($this->storage)) {
             die('The cache directory not exists.');
         } elseif (!is_writable($this->storage)) {
             die('The cache directory is not writable. You should fix the permissions.');
         } else {
             $this->storage = $storage;
         }
     }
 }
开发者ID:RoxasShadow,项目名称:Workspace,代码行数:14,代码来源:class.Caching.php


示例19: __construct

 function __construct()
 {
     $this->list_error = array();
     $this->link = @mysql_connect(DB_HOST, DB_USER, DB_PASS);
     if (mysql_error($this->link)) {
         $this->list_error[] = mysql_error($this->link);
     } else {
         @mysql_selectdb(DB_NAME, $this->link);
         if (mysql_error($this->link)) {
             $this->list_error[] = mysql_error($this->link);
         } else {
             mysql_set_charset('utf8', $this->link);
         }
     }
 }
开发者ID:Edgardoweb,项目名称:cedula-api,代码行数:15,代码来源:classDBAndUser.php


示例20: db_connect

function db_connect() {
  global $DBI_DATABASE, $DBI_USERNAME, $DBI_PASSWORD, $DBI_HOST, $DBI_ERROR, $DBI_HANDLE;
  if (!$DBI_HANDLE) {
    if (!($DBI_HANDLE = mysql_connect($DBI_HOST, $DBI_USERNAME, $DBI_PASSWORD))) {
      db_set_error(mysql_error());
      return 0;
    }

    if (!mysql_selectdb($DBI_DATABASE, $DBI_HANDLE)) {
      db_set_error(mysql_error());
      mysql_close($DBI_HANDLE);
      $DBI_HANDLE=undef;
      return 0;
    }
  }
  return 1;
};
开发者ID:anzi,项目名称:halfnote_old,代码行数:17,代码来源:_database.php



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
PHP mysql_set_charset函数代码示例发布时间:2022-05-15
下一篇:
PHP mysql_select_single函数代码示例发布时间: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