当前位置: 首页>>代码示例>>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;未经允许,请勿转载。