ovrimos_fetch_into

(PHP 4 >= 4.0.3, PHP 5)

ovrimos_fetch_into -- 結果からレコードを取得する

説明

boolean ovrimos_fetch_into ( int result_id, array result_array, string [how], int [rownumber])

ovrimos_fetch_into() は結果からレコードを取得 するために使用されます。

ovrimos_fetch_into() はクエリ結果からレコード を'result_array'に取得します。この引数は参照として指定する必要が あります。取得されるレコードは、最後の二つのパラメータで指定され ます。'how'は、'Next'(デフォルト)、'Prev'、'First'、'Last'、 'Absolute'のどれかであり、それぞれ、現在位置の次、現在位置の前、 先頭から前方、終端から後方、先頭から絶対位置('first'と本質的に等 価ですが、'rownumber'が必要)となります。大文字小文字は関係ありま せん。'rownumber'は絶対位置を指定する場合以外はオプションです。 TRUEまたはFALSEを返します。

例 1. 取得する例

<?php
$conn
=ovrimos_connect ("neptune", "8001", "admin", "password");
if (
$conn!=0) {
    echo
"Connection ok!";
    
$res=ovrimos_exec ($conn,"select table_id, table_name from sys.tables");
    if (
$res != 0) {
        echo
"Statement ok!";
        if (
ovrimos_fetch_into ($res, &$row)) {
            list (
$table_id, $table_name) = $row;
            echo
"table_id=".$table_id.", table_name=".$table_name."\n";
            if (
ovrimos_fetch_into ($res, &$row)) {
                list (
$table_id, $table_name) = $row;
                echo
"table_id=".$table_id.", table_name=".$table_name."\n";
            } else {
                echo
"Next: error\n";
            }
        } else {
            echo
"First: error\n";
        }
        
ovrimos_free_result ($res);
    }
    
ovrimos_close ($conn);
}
?>
この例はレコードを1件取得します。