- MySQLi 教程
- MySQLi - 首頁
- MySQLi - 介紹
- MySQLi - PHP 語法
- MySQLi - 連線
- MySQLi - 建立資料庫
- MySQLi - 刪除資料庫
- MySQLi - 選擇資料庫
- MySQLi - 建立表
- MySQLi - 刪除表
- MySQLi - 插入查詢
- MySQLi - 選擇查詢
- MySQLi - Where 條件
- MySQLi - 更新查詢
- MySQLi - 刪除查詢
- MySQLi - Like 條件
- MySQLi - 排序結果
- MySQLi - 使用連線
- MySQLi - 處理 NULL 值
- 獲取和使用 MySQLi 元資料
- MySQL
- MySQL - 安裝
- MySQL - 管理
- MySQL - 資料型別
- MySQL - 正則表示式
- MySQL - 事務
- MySQL - Alter 命令
- MySQL - 索引
- MySQL - 臨時表
- MySQL - 克隆表
- MySQL - 使用序列
- MySQL - 處理重複項
- MySQLi 有用資源
- MySQLi - 有用函式
- MySQLi - 快速指南
- MySQLi - 有用資源
- MySQLi - 討論
MySQLi - 使用結果
語法
mysqli_result mysqli::use_result ( void )
定義和用法
用於啟動結果集檢索
範例
試著執行下面的範例 −
<?php
$servername = "localhost:3306";
$username = "root";
$password = "";
$dbname = "TUTORIALS";
$conn = new mysqli($servername, $username, $password, $dbname);
if (!$conn->real_connect($servername, $username, $password, $dbname)) {
die('Connect Error (' . mysqli_connect_errno() . ') '. mysqli_connect_error());
}
echo "Database connected";
$query = "SELECT CURRENT_USER();";
$query .= "SELECT name FROM tutorials_auto ORDER BY ID";
if ($conn->multi_query($query)) {
do {
if ($result = $conn->use_result()) {
while ($row = $result->fetch_row()) {
printf("%s\n", $row[0]);
}
$result->close();
}
if ($conn->more_results()) {
printf("******************\n");
}
} while ($conn->next_result());
}
mysqli_close($conn);
?>
以上程式碼的示例輸出應如下所示 −
Database connectedroot@localhost ****************** sai ram sairamkrishna sai
mysqli_useful_functions.htm
廣告