當前位置: 首頁>>代碼示例>>PHP>>正文


PHP mysqli::change_user方法代碼示例

本文整理匯總了PHP中mysqli::change_user方法的典型用法代碼示例。如果您正苦於以下問題:PHP mysqli::change_user方法的具體用法?PHP mysqli::change_user怎麽用?PHP mysqli::change_user使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在mysqli的用法示例。


在下文中一共展示了mysqli::change_user方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: mysqli

<?php

require '../classes/AutoLoad.php';
date_default_timezone_set('Europe/Madrid');
$mysql = new mysqli(Constan::SERVER, Constan::DBUSER, Constan::DBPASSWORD);
$res = $mysql->query(FileManager::read('sql/sql.sql'));
$mysql->change_user(Constan::DBUSER, Constan::DBPASSWORD, Constan::DATABASE);
$ms = scandir('../modules');
foreach ($ms as $key => $value) {
    if ($value !== '.' && $value !== '..' && $value !== 'index.php') {
        if (is_dir('../modules/' . $value)) {
            $files = scandir('../modules/' . $value . '/sql');
            foreach ($files as $file) {
                if ($file !== '.' && $file !== '..') {
                    $mysql->query(FileManager::read('../modules/' . $value . '/sql/' . $file));
                }
            }
        }
    }
}
$mysql->close();
header('Location:../modules/');
開發者ID:developdms,項目名稱:Practica-5,代碼行數:22,代碼來源:loadmodules.php

示例2: changeDatabase

 /**
  * Change currently selected database.
  * @param string $databaseName New database name.
  * @return boolean Returns <b>TRUE</b> on success or <b>FALSE</b> on failure.
  */
 public function changeDatabase($databaseName)
 {
     if (parent::change_user($this->userName, $this->userPassword, $databaseName)) {
         $this->databaseName = $databaseName;
         return TRUE;
     }
     return FALSE;
 }
開發者ID:camelcasetechsd,項目名稱:training-careers,代碼行數:13,代碼來源:MySQLiQuery.php

示例3: elseif

 } elseif (strlen($_POST["DatabaseWriterHost"]) > 64) {
     $pageErrors[] = "Database Writer Connectivity Host must not be greater than 64 characters.";
 }
 if ($_POST["DatabaseWriterPass"] == "") {
     $pageErrors[] = "Database Writer Password must not be empty.";
 } elseif (strlen($_POST["DatabaseWriterPass"]) > 20) {
     $pageErrors[] = "Database Writer Password must not be greater than 20 characters.";
 }
 if (count($pageErrors) == 0) {
     $mySQLiConn = new mysqli("p:" . $mysqlHost, $mysqlAdminUser, $mysqlAdminPass, "mysql", $mysqlPort);
     if (!$mySQLiConn->connect_error) {
         // -- create database
         $createDatabase = "CREATE DATABASE `" . $databaseName . "` DEFAULT CHARACTER SET utf8 COLLATE utf8_bin";
         if ($mySQLiConn->query($createDatabase)) {
             $pageSuccess[] = "Successfully created database `" . $databaseName . "`.";
             $mySQLiConn->change_user($mysqlAdminUser, $mysqlAdminPass, $databaseName);
             if (!$mySQLiConn->connect_error) {
                 // -- create table `hotlaps`
                 if ($mySQLiConn->query($createTableHotlaps)) {
                     $pageSuccess[] = "Successfully created table `hotlaps`.";
                 } else {
                     $pageErrors[] = "Error creating table `hotlaps`: (" . $mySQLiConn->error . ")";
                 }
                 // -- create table `racelaps`
                 if ($mySQLiConn->query($createTableRacelaps)) {
                     $pageSuccess[] = "Successfully created table `racelaps`.";
                 } else {
                     $pageErrors[] = "Error creating table `racelaps`: (" . $mySQLiConn->error . ")";
                 }
                 // -- create table `sessioninfos`
                 if ($mySQLiConn->query($createTableSessioninfos)) {
開發者ID:knackko,項目名稱:vmliveview_bs,代碼行數:31,代碼來源:setup.php

示例4: change_user

 /**
  * (non-PHPdoc)
  * @see mysqli::change_user()
  * @return bool
  */
 public function change_user($user, $password, $database = NULL)
 {
     if (isset($database)) {
         $this->setDb($database);
     }
     $this->setUsername($user);
     $this->setPassword($password);
     return parent::change_user($this->getUsername(), $this->password, $this->getDb());
 }
開發者ID:advation,項目名稱:TimeTracker,代碼行數:14,代碼來源:DB.class.php

示例5: mysqliConnect

function mysqliConnect($db = null)
{
    $db = $db ? $db : $_SESSION['base_datos']->nombrebd;
    $mysqli = new mysqli(BD_HOST, BD_SP_USUARIO, BD_SP_CLAVE, $db);
    if (mysqli_connect_errno()) {
        $error_db['TIPO ERROR'] = "LA BASE DE DATOS NO SE ENCUENTRA DISPONIBLE, ERROR DE CONEXIÓN";
        $error_db['MYSQLI ERROR'] = mysqli_connect_error();
        dpr($error_db);
        exit;
    }
    $mysqli->change_user(BD_SP_USUARIO, BD_SP_CLAVE, $db);
    return $mysqli;
}
開發者ID:ranmadxs,項目名稱:dorcl,代碼行數:13,代碼來源:MySQL_Lib.php


注:本文中的mysqli::change_user方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。