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


PHP mysqli_store_result函数代码示例

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


在下文中一共展示了mysqli_store_result函数的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: 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

示例3: execSP

 function execSP($sql)
 {
     $this->connMySQL();
     $this->sql = $sql;
     $i = 0;
     $result_ = null;
     if (mysqli_multi_query($this->conn, $this->sql)) {
         do {
             if ($this->resultado = mysqli_store_result($this->conn)) {
                 while ($row = mysqli_fetch_array($this->resultado)) {
                     $result_ = $row;
                 }
                 mysqli_free_result($this->resultado);
             }
             $i++;
         } while (mysqli_next_result($this->conn));
         mysqli_close($this->conn);
     } else {
         echo mysqli_error($this->conn);
         $this->closeConnMySQL();
         exit;
     }
     $this->closeConnMySQL();
     return $result_;
 }
开发者ID:kevinMoreira,项目名称:Lab,代码行数:25,代码来源:MySQL.php

示例4: 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

示例5: ResistMenuLog

 public function ResistMenuLog($_uid, $_log)
 {
     $query = "TRUNCATE TABLE UM" . $_uid . ";";
     $result = $this->_db_throw_query("Users_Geo", $query);
     $query = "";
     $tmp = "INSERT INTO UM" . $_uid . " VALUES ( '";
     for ($i = 0; $i < 7; $i++) {
         for ($j = 0; $j < 3; $j++) {
             if ($j == 2) {
                 if (strpos($_log[$this->week[$i]][$this->kind[$j]], '|') !== false) {
                     $div = explode('|', $_log[$this->week[$i]][$this->kind[$j]]);
                     $size = count($div);
                     for ($k = 0; $k < $size; $k++) {
                         $query = $query . $tmp . $div[$k] . "', '" . $this->kind[$j] . "', ( NOW() + INTERVAL " . $i . " DAY ) );";
                     }
                     break;
                 }
             }
             $query = $query . $tmp . $_log[$this->week[$i]][$this->kind[$j]] . "', '" . $this->kind[$j] . "', ( NOW() + INTERVAL " . $i . " DAY ) );";
         }
     }
     $this->_db_select("Users_Geo");
     $result = mysqli_multi_query($this->_connection, $query);
     if (!$result) {
         print "Quely Failed.\n" . mysqli_error($this->_connection);
         return false;
     }
     do {
         mysqli_store_result($this->_connection);
     } while (mysqli_next_result($this->_connection));
     return true;
 }
开发者ID:Reciplan,项目名称:Web,代码行数:32,代码来源:liblog.php

示例6: 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

示例7: fn_execSQL

function fn_execSQL($sql, $r = 0)
{
    global $conexao;
    if (mysqli_multi_query($conexao, $sql)) {
        $resultado = mysqli_store_result($conexao);
        if ($resultado) {
            //prepara um array com os campos/colunas da consulta
            $i = 0;
            while ($obj = mysqli_fetch_field($resultado)) {
                $arrayCampos[$i] = $obj->name;
                $i++;
            }
            //prepara um array associativo com o resultado da consulta
            $i = 0;
            while ($linha = mysqli_fetch_array($resultado)) {
                for ($j = 0; $j < count($arrayCampos); $j++) {
                    $retorno[$i][$arrayCampos[$j]] = $linha[$arrayCampos[$j]];
                }
                $i++;
            }
            mysqli_free_result($resultado);
        }
        //mysqli_close($conexao_geral);
        if (isset($retorno)) {
            return $retorno;
        } else {
            return null;
        }
    } else {
        echo "<p>N�o foi poss�vel executar a seguinte instru��o SQL:</p><p><strong>{$sql}</strong></p>\n" . "<p>Erro MySQL: " . mysqli_error($conexao) . "</p>";
        exit;
        //mysqli_close($conexao_geral);
    }
}
开发者ID:iaraujoisraell,项目名称:Educacional,代码行数:34,代码来源:conexao.php

示例8: finalize_order

 function finalize_order($eid, $details_xml)
 {
     //	$sql = sprintf("Call finalize_order(%s,%s)",$eid, $details_xml);
     //	if (!mysqli_multi_query($_SESSION['mysqli_link'], $sql )) echo "<div style='z-index:1500'>ERROR! (UpdaterSprocsContainer:aassdskarek)".mysqli_error($_SESSION['mysqli_link'])."</div>";
     //<<<EOT
     $QUERY = sprintf("Call finalize_order(%s,%s,@out_order_id);", $eid, $details_xml) . "SELECT @out_order_id as order_id;";
     //EOT;
     $mysqli = $_SESSION['mysqli_link'];
     $query = mysqli_multi_query($mysqli, $QUERY) or die("error 9832lkjaklh3" . mysqli_error($mysqli));
     if ($query) {
         do {
             if ($result = mysqli_store_result($mysqli)) {
                 $subresult = mysqli_fetch_assoc($result);
                 if (!isset($subresult['order_id'])) {
                     continue;
                 }
                 $_SESSION['finalized_order_id'] = $subresult['order_id'];
                 // foreach( $subresult AS $k => $v )
                 //  {
                 //   var_dump( $k , $v );
                 //  }
             }
         } while (mysqli_next_result($mysqli));
     }
 }
开发者ID:awgtek,项目名称:myedb,代码行数:25,代码来源:UpdaterSprocsContainer.php

示例9: sqllogin

function sqllogin($host, $dbuser, $dbpass, $dbname)
{
    // connectivity
    //mysql connections for stacked query examples.
    $con1 = mysqli_connect($host, $dbuser, $dbpass, $dbname);
    $username = mysqli_real_escape_string($con1, $_POST["login_user"]);
    $password = $_POST["login_password"];
    // Check connection
    if (mysqli_connect_errno($con1)) {
        echo "Failed to connect to MySQL: " . mysqli_connect_error();
    } else {
        @mysqli_select_db($con1, $dbname) or die("Unable to connect to the database ######: ");
    }
    /* execute multi query */
    $sql = "SELECT * FROM users WHERE username='{$username}' and password='{$password}'";
    if (@mysqli_multi_query($con1, $sql)) {
        /* store first result set */
        if ($result = @mysqli_store_result($con1)) {
            if ($row = @mysqli_fetch_row($result)) {
                if ($row[1]) {
                    return $row[1];
                } else {
                    return 0;
                }
            }
        }
    }
}
开发者ID:intfrr,项目名称:sqli-labs,代码行数:28,代码来源:login.php

示例10: ClearStoredResults

 public function ClearStoredResults($link)
 {
     while (mysqli_next_result($link)) {
         if ($resultval = mysqli_store_result($link)) {
             $this->free_result($resultval);
         }
     }
 }
开发者ID:niteshsinha,项目名称:OQM,代码行数:8,代码来源:database.php

示例11: freeDBResource

 function freeDBResource($dbh)
 {
     while (mysqli_next_result($dbh)) {
         if ($l_result = mysqli_store_result($dbh)) {
             mysqli_free_result($l_result);
         }
     }
 }
开发者ID:sarrab,项目名称:CrazEvent,代码行数:8,代码来源:DB_active_rec.php

示例12: fnc

 public static function fnc($f, $p)
 {
     if (self::$msql == NULL) {
         self::$msql = mysqli_connect(self::$host, self::$user, self::$pass, self::$base);
         mysqli_query(self::$msql, 'SET NAMES UTF8');
     }
     mysqli_multi_query(self::$msql, "CALL {$f}({$p})");
     $result = mysqli_store_result(self::$msql);
     $r = self::fetch_r($result);
     return $r;
 }
开发者ID:JoeMaputo,项目名称:Short_Classes,代码行数:11,代码来源:class.stbase.php

示例13: getGenres

function getGenres()
{
    global $db;
    $stmt = mysqli_prepare($db, 'SELECT id, name FROM genres');
    mysqli_stmt_execute($stmt);
    mysqli_store_result($db);
    mysqli_stmt_bind_result($stmt, $id, $genre);
    while (mysqli_stmt_fetch($stmt)) {
        $genres[$id] = $genre;
    }
    return $genres;
}
开发者ID:AlexandrosKal,项目名称:mylib,代码行数:12,代码来源:genres_functions.php

示例14: 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

示例15: 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


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