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


PHP mysqli_more_results函数代码示例

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


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

示例1: execute_multi

function execute_multi($link, $arr_sqls, &$error)
{
    $sqls = implode(';', $arr_sqls) . ';';
    if (mysqli_multi_query($link, $sqls)) {
        $data = array();
        $i = 0;
        //计数
        do {
            if ($result = mysqli_store_result($link)) {
                $data[$i] = mysqli_fetch_all($result);
                mysqli_free_result($result);
            } else {
                $data[$i] = null;
            }
            $i++;
            if (!mysqli_more_results($link)) {
                break;
            }
        } while (mysqli_next_result($link));
        if ($i == count($arr_sqls)) {
            return $data;
        } else {
            $error = "sql语句执行失败:<br />&nbsp;数组下标为{$i}的语句:{$arr_sqls[$i]}执行错误<br />&nbsp;错误原因:" . mysqli_error($link);
            return false;
        }
    } else {
        $error = '执行失败!请检查首条语句是否正确!<br />可能的错误原因:' . mysqli_error($link);
        return false;
    }
}
开发者ID:sakuraliu,项目名称:bbs,代码行数:30,代码来源:mysql.inc.php

示例2: clone_db

 function clone_db($database_name = false, $organization_id = false)
 {
     $qry = $this->db->query('CREATE DATABASE ' . $database_name);
     if (!$qry) {
         $value = array('code' => '500', 'organization_id' => $organization_id);
         $json_data = json_encode($value);
         redirect('http://junctiondev.cloudapp.net/appmanager/login/result_application?json=' . $json_data);
     }
     $this->session->set_userdata('db_name', $database_name);
     $this->session->userdata('db_name');
     if ($_SERVER['HTTP_HOST'] == "localhost") {
         //$dbname=$database_name;
         $password = "";
         $username = "root";
     }
     if ($_SERVER['HTTP_HOST'] == "junctiondev.cloudapp.net") {
         //$dbname=$database_name;
         $password = "bitnami";
         $username = "root";
     }
     if ($_SERVER['HTTP_HOST'] == "junctiontech.in") {
         //$dbname=$database_name;
         $password = "junction4\$";
         $username = "junctwhx";
     }
     $connect = mysqli_connect('localhost', $username, $password, $database_name);
     $db_file = file_get_contents('junctionerp.sql');
     mysqli_multi_query($connect, $db_file);
     do {
         mysqli_store_result($connect);
     } while (mysqli_more_results($connect) && mysqli_next_result($connect));
     return true;
 }
开发者ID:junctiontech,项目名称:careermitra,代码行数:33,代码来源:User_management_model.php

示例3: cloneDB

 function cloneDB($database_name = false)
 {
     $this->db->query('CREATE DATABASE ' . $database_name);
     if ($_SERVER['HTTP_HOST'] == "localhost") {
         //$dbname=$database_name;
         $password = "";
         $username = "root";
     }
     if ($_SERVER['HTTP_HOST'] == "junctiondev.cloudapp.net") {
         //$dbname=$database_name;
         $password = "bitnami";
         $username = "root";
     }
     if ($_SERVER['HTTP_HOST'] == "junctiontech.in") {
         //$dbname=$database_name;
         $password = "junction4\$";
         $username = "junctwhx";
     }
     $connect = mysqli_connect('localhost', $username, $password, $database_name);
     $db_file = file_get_contents('school_mgt.sql');
     mysqli_multi_query($connect, $db_file);
     do {
         mysqli_store_result($connect);
     } while (mysqli_more_results($connect) && mysqli_next_result($connect));
 }
开发者ID:junctiontech,项目名称:appmanager,代码行数:25,代码来源:restAPI_model.php

示例4: task_optimize

function task_optimize($connection, $settings, $time, $table = false, $and_default = true)
{
    require_once $settings['functions'] . 'function.task.log.php';
    if ($table) {
        $tables[] = $table;
    }
    if ($and_default) {
        $tables[] = 'peers';
        $tables[] = 'tasks';
        $tables[] = 'torrents';
    }
    $sql = '';
    foreach ($tables as $table) {
        $sql .= 'CHECK TABLE `' . $settings['db_prefix'] . $table . '`;' . 'ANALYZE TABLE `' . $settings['db_prefix'] . $table . '`;' . 'REPAIR TABLE `' . $settings['db_prefix'] . $table . '`;' . 'OPTIMIZE TABLE `' . $settings['db_prefix'] . $table . '`;';
    }
    $result = mysqli_multi_query($connection, $sql);
    if ($result) {
        while (mysqli_more_results($connection)) {
            mysqli_next_result($connection);
            mysqli_store_result($connection);
        }
    }
    if ($result) {
        task_log($connection, $settings, 'optimize', $time);
    }
    return $result;
}
开发者ID:dogsAreReallyCool,项目名称:phoenix,代码行数:27,代码来源:function.task.optimize.php

示例5: callStoredProcedure

function callStoredProcedure($procedure)
{
    global $link;
    // if (DEBUGGING) { echo  "CALL ".$procedure ."<BR>";}
    $resultset = mysqli_multi_query($link, "CALL " . $procedure) or die(__FILE__ . __LINE__ . mysqli_error($link) . $procedure);
    $data = mysqli_store_result($link);
    // clear remaining sets in the resultset before returning
    while (mysqli_more_results($link)) {
        mysqli_next_result($link);
    }
    return $data;
}
开发者ID:language-learners,项目名称:superchallengebot,代码行数:12,代码来源:database.php

示例6: query

 public function query($SQL)
 {
     if ($SQL !== "") {
         if (stristr($SQL, "call") and stripos($SQL, "call") === 0) {
             mysqli_multi_query(self::$connection, $SQL);
             $this->query = mysqli_store_result(self::$connection);
             if (mysqli_more_results(self::$connection)) {
                 mysqli_next_result(self::$connection);
             }
         } else {
             $this->query = mysqli_query(self::$connection, $SQL);
         }
     }
     return $this->query ? $this->query : false;
 }
开发者ID:jgianpiere,项目名称:ZanPHP,代码行数:15,代码来源:mysqli_db.php

示例7: Query

 /**
  * Send an SQL Query to the DB
  *
  * @param string $query
  * @return mysql_result
  */
 public function Query($query)
 {
     try {
         if (!$this->connection) {
             throw new ErrorException();
         }
         $result = mysqli_query($this->connection, $query);
         while (mysqli_more_results($this->connection)) {
             mysqli_next_result($this->connection);
         }
         return $result;
     } catch (ErrorException $obj) {
         @error_log($query . $this->errorString);
     }
     //end try
 }
开发者ID:asalem,项目名称:collections,代码行数:22,代码来源:DB.php

示例8: flush

 /**
  * Free memory associated with the resultset
  *
  * @return void
  */
 public function flush()
 {
     if ($this->result instanceof mysqli_stmt) {
         $this->result->free_result();
     }
     $this->result = null;
     $this->col_info = null;
     // Sanity check before using the handle
     if (empty($this->dbh) || !$this->dbh instanceof mysqli) {
         return;
     }
     // Clear out any results from a multi-query
     while (mysqli_more_results($this->dbh)) {
         mysqli_next_result($this->dbh);
     }
 }
开发者ID:mpeshev,项目名称:wp-db-driver,代码行数:21,代码来源:mysqli.php

示例9: executeQuery

function executeQuery($query, $host, $user, $pass, $db, $port, $link = null)
{
    if (!$link && !connect($link, $host, $user, $pass, $db, $port)) {
        return false;
    } else {
        if (isset($db) && !mysqli_select_db($link, $db)) {
            return false;
        }
    }
    if (!mysqli_multi_query($link, $query) || $link->error != '') {
        return false;
    }
    while (mysqli_more_results($link) && mysqli_next_result($link)) {
        $discard = mysqli_store_result($link);
    }
    $link->commit();
    return true;
}
开发者ID:richhl,项目名称:kalturaCE,代码行数:18,代码来源:uninstall.php

示例10: sql

function sql($string)
{
    global $db;
    global $result;
    if (trim($string) === '') {
        return;
    }
    mysqli_multi_query($db, $string) or die("MySQL Error when executing: {$string} <br/>\n" . mysqli_error($db) . "\n");
    $test = true;
    while (mysqli_more_results($db)) {
        $test = false;
        $result = mysqli_store_result($db);
        mysqli_next_result($db) or die("MySQL Error when executing: {$string} <br/>\n" . mysqli_error($db) . "\n");
    }
    if ($test) {
        $result = mysqli_store_result($db);
    }
}
开发者ID:JonLoesch,项目名称:security,代码行数:18,代码来源:db.php

示例11: clone_db

 function clone_db($database_name = false)
 {
     //echo $database_name; return;
     $this->db->query('CREATE DATABASE ' . $database_name);
     if ($_SERVER['HTTP_HOST'] == "localhost") {
         //$dbname=$database_name;
         $password = "";
         $username = "root";
     }
     if ($_SERVER['HTTP_HOST'] == "junctiondev.cloudapp.net") {
         //$dbname=$database_name;
         $password = "bitnami";
         $username = "root";
     }
     if ($_SERVER['HTTP_HOST'] == "junctiontech.in") {
         //$dbname=$database_name;
         $password = "junction4\$";
         $username = "junctwhx";
     }
     $connect = mysqli_connect('localhost', $username, $password, $database_name);
     $db_file = file_get_contents('school_mgt.sql');
     mysqli_multi_query($connect, $db_file);
     do {
         mysqli_store_result($connect);
     } while (mysqli_more_results($connect) && mysqli_next_result($connect));
     $query = "SELECT count(*) as 'Tables', table_schema as 'Database' FROM information_schema.TABLES WHERE table_schema= '" . $database_name . "' GROUP BY table_schema";
     $result = mysqli_query($connect, $query);
     $countTable = mysqli_fetch_assoc($result);
     //echo $countTable['Tables'];die;
     if (isset($countTable['Tables']) && $countTable['Tables'] == '76') {
         return true;
     } else {
         //$CII =& get_instance();
         // 	$CII->load->library('session'); //if it's not autoloaded in your CI setup
         //  	$database_name=$CII->session->userdata('db_name');
         // 	$CII->session->unset_userdata($database_name);
         // 	$CII->session->sess_destroy();
         echo 'database does not exist';
         return;
         die;
     }
 }
开发者ID:junctiontech,项目名称:appmanager,代码行数:42,代码来源:login_model.php

示例12: testMysqli

 private function testMysqli()
 {
     $connection = mysqli_connect($this->host, $this->user, $this->pass, $this->db, $this->port) or $this->error("Unable to connect:" . mysqli_connect_error());
     $rows = [];
     if (mysqli_multi_query($connection, "SHOW TABLES FROM {$this->db};")) {
         do {
             if ($result = mysqli_use_result($connection)) {
                 while ($row = mysqli_fetch_row($result)) {
                     $rows[] = $row[0];
                 }
                 if (!mysqli_more_results($connection)) {
                     break;
                 }
                 mysqli_free_result($result);
             }
         } while (mysqli_next_result($connection));
     }
     mysqli_close($connection);
     return $rows;
 }
开发者ID:muzammalali,项目名称:php-mysql-access-test,代码行数:20,代码来源:mysql.php

示例13: exec

 protected function exec($qs)
 {
     if (null == $this->conn) {
         return false;
     }
     $status = true;
     foreach ($qs as $q) {
         $res = @mysqli_query($this->conn, $q);
         if (false == $res) {
             $this->session->addError(@mysqli_error($this->conn));
             $status = false;
             continue;
         }
         if (@mysqli_more_results($this->conn)) {
             @mysqli_next_result($this->conn);
             @mysqli_free_result($res);
         }
     }
     return $status;
 }
开发者ID:vberzsin,项目名称:2014,代码行数:20,代码来源:RootDBUtils.php

示例14: executeQuery

 /**
  * Execute a mySQL query or multi queries
  * @param string $query mySQL query, or multiple queries seperated by a ';'
  * @param array $db_params db parameters array 'db_host', 'db_user', 'db_pass', 'db_port'
  * @param string $db_name database name
  * @param mysqli $link mysqli link
  * @return true on success, false otherwise
  */
 public static function executeQuery($query, $db_params, $db_name, $link = null)
 {
     // connect if not yet connected
     if (!$link && !self::connect($link, $db_params, $db_name)) {
         return false;
     } else {
         if (isset($db_name) && !mysqli_select_db($link, $db_name)) {
             logMessage(L_ERROR, "Cannot execute query: could not find the db: {$db}");
             return false;
         }
     }
     // execute all queries
     if (!mysqli_multi_query($link, $query) || $link->error != '') {
         logMessage(L_ERROR, "Cannot execute query: error with query: {$query}, error: " . $link->error);
         return false;
     }
     // flush
     while (mysqli_more_results($link) && mysqli_next_result($link)) {
         $discard = mysqli_store_result($link);
     }
     $link->commit();
     return true;
 }
开发者ID:EfncoPlugins,项目名称:Media-Management-based-on-Kaltura,代码行数:31,代码来源:DatabaseUtils.class.php

示例15: func_test_mysqli_next_result

function func_test_mysqli_next_result($link, $query, $offset, $num_results, $strict_on)
{
    if (!mysqli_multi_query($link, $query)) {
        printf("[%03d] [%d] %s\n", $offset, mysqli_errno($link), mysqli_error($link));
    }
    $i = 0;
    if ($strict_on) {
        ob_start();
    }
    do {
        if ($res = mysqli_store_result($link)) {
            mysqli_free_result($res);
            $i++;
        }
    } while (true === mysqli_next_result($link));
    if ($strict_on) {
        $tmp = ob_get_contents();
        ob_end_clean();
        if (!preg_match('@Strict Standards: mysqli_next_result\\(\\): There is no next result set@ismU', $tmp)) {
            printf("[%03d] Strict Standards warning missing\n", $offset + 1);
        } else {
            $tmp = trim(preg_replace('@Strict Standards: mysqli_next_result\\(\\).*on line \\d+@ism', '', $tmp));
        }
        print trim($tmp) . "\n";
    }
    if ($i !== $num_results) {
        printf("[%03d] Expecting %d result(s), got %d result(s)\n", $offset + 2, $num_results, $i);
    }
    if (mysqli_more_results($link)) {
        printf("[%03d] mysqli_more_results() indicates more results than expected\n", $offset + 3);
    }
    if (!($res = mysqli_query($link, "SELECT 1 AS b"))) {
        printf("[%03d] [%d] %s\n", $offset + 4, mysqli_errno($link), mysqli_error($link));
    } else {
        mysqli_free_result($res);
    }
}
开发者ID:gleamingthecube,项目名称:php,代码行数:37,代码来源:ext_mysqli_tests_mysqli_next_result.php


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