本文整理汇总了PHP中mysqli_next_result函数的典型用法代码示例。如果您正苦于以下问题:PHP mysqli_next_result函数的具体用法?PHP mysqli_next_result怎么用?PHP mysqli_next_result使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了mysqli_next_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 /> 数组下标为{$i}的语句:{$arr_sqls[$i]}执行错误<br /> 错误原因:" . mysqli_error($link);
return false;
}
} else {
$error = '执行失败!请检查首条语句是否正确!<br />可能的错误原因:' . mysqli_error($link);
return false;
}
}
示例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));
}
示例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_;
}
示例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;
}
示例5: 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));
}
}
示例6: query
function query($sql, $check_duplicate = '')
{
if (empty($this->link_id)) {
die('Нет подключения к базе данных');
}
if ($sql == '') {
die('Пустой запрос');
}
$run_query = 1;
/* Проверка на наличе дубликата у добавляемых данных */
if ($check_duplicate != '') {
if ($this->check_double($sql) == false) {
$run_query = 0;
write_log($run_query, 'double_check');
}
}
if ($run_query == 1) {
if ($this->query_id = mysqli_query($this->link_id, $sql)) {
mysqli_next_result($this->link_id);
return $this->query_id;
} else {
$this->error($sql);
}
} else {
//return false;
}
}
示例7: 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;
}
示例8: get_menu
public function get_menu($parent = 0)
{
$active_lang = $this->db->escape($this->config->item('language_abbr'));
$result = $this->db->query("call get_menu({$active_lang},'page','{$parent}','published')");
mysqli_next_result($this->db->conn_id);
return $result;
}
示例9: 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;
}
示例10: ClearStoredResults
public function ClearStoredResults($link)
{
while (mysqli_next_result($link)) {
if ($resultval = mysqli_store_result($link)) {
$this->free_result($resultval);
}
}
}
示例11: freeDBResource
function freeDBResource($dbh)
{
while (mysqli_next_result($dbh)) {
if ($l_result = mysqli_store_result($dbh)) {
mysqli_free_result($l_result);
}
}
}
示例12: free_mysqli_results
function free_mysqli_results()
{
while (mysqli_next_result($_SESSION['mysqli_link'])) {
//free each result.
$result = mysqli_use_result($_SESSION['mysqli_link']);
if ($result instanceof mysqli_result) {
$result->free();
}
}
}
示例13: get_consistency_board
public function get_consistency_board()
{
$this->config->load('wellness');
$query = "call consistency(" . $this->config->item('hw_consistency_goal') . ")";
$result = $this->db->query($query);
$array = $result->result_array();
// Need to run this to free up resource for next query
// see: http://stackoverflow.com/questions/16029729/mysql-error-commands-out-of-sync-you-cant-run-this-command-now
mysqli_next_result($this->db->conn_id);
return $array;
}
示例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;
}
示例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;
}