此函式的功能與其對應的 Microsoft SQL Server 函式 mssql_next_result() 完全相同。 以上資訊相當模糊且有點誤導,因此請參考此函式的 mssql 版本以了解如何正確使用它的詳細資訊。
備註:它適用於預存程序。
(PHP 4 >= 4.0.5, PHP 5, PHP 7, PHP 8)
odbc_next_result — 檢查是否有可用的多個結果集
檢查是否還有更多結果集可用,並允許透過 odbc_fetch_array()、odbc_fetch_row()、odbc_result() 等函式存取下一個結果集。
statement
ODBC 結果物件。
版本 | 說明 |
---|---|
8.4.0 |
statement 現在需要一個 Odbc\Result 實例;先前需要的是 資源。 |
範例 #1 odbc_next_result()
<?php
$r_Connection = odbc_connect($dsn, $username, $password);
$s_SQL = <<<END_SQL
SELECT 'A'
SELECT 'B'
SELECT 'C'
END_SQL;
$r_Results = odbc_exec($r_Connection, $s_SQL);
$a_Row1 = odbc_fetch_array($r_Results);
$a_Row2 = odbc_fetch_array($r_Results);
echo "傾印第一個結果集";
var_dump($a_Row1, $a_Row2);
echo "取得第二個結果集";
var_dump(odbc_next_result($r_Results));
$a_Row1 = odbc_fetch_array($r_Results);
$a_Row2 = odbc_fetch_array($r_Results);
echo "傾印第二個結果集";
var_dump($a_Row1, $a_Row2);
echo "取得第三個結果集";
var_dump(odbc_next_result($r_Results));
$a_Row1 = odbc_fetch_array($r_Results);
$a_Row2 = odbc_fetch_array($r_Results);
echo "傾印第三個結果集";
var_dump($a_Row1, $a_Row2);
echo "嘗試取得第四個結果集";
var_dump(odbc_next_result($r_Results));
?>
以上範例將會輸出
Dump first result set array(1) { ["A"]=> string(1) "A" } bool(false) Get second results set bool(true) Dump second result set array(1) { ["B"]=> string(1) "B" } bool(false) Get third results set bool(true) Dump third result set array(1) { ["C"]=> string(1) "C" } bool(false) Try for a fourth result set bool(false)
此函式的功能與其對應的 Microsoft SQL Server 函式 mssql_next_result() 完全相同。 以上資訊相當模糊且有點誤導,因此請參考此函式的 mssql 版本以了解如何正確使用它的詳細資訊。
備註:它適用於預存程序。