mysqli_data_seek,
mysqli_data_seek, result->data_seek() — 結果の任意の行にポインタを移動する
説明
手続き型:bool mysqli_data_seek ( mysqli_result result, int offset )
オブジェクト指向型(メソッド):
class mysqli_result {
bool data_seek ( int offset )
} mysqli_data_seek() 関数は、 結果セットの任意の行 offset にポインタを移動します。
パラメータ
- result
- 手続き型のみ:
mysqli_query()、mysqli_store_result()
あるいは mysqli_use_result() が返す結果セット ID。
- offset
- 
       フィールドオフセット。ゼロから全行数 - 1 までの間
      (0..mysqli_num_rows() - 1)である必要があります。
      
返り値
成功した場合に TRUE を、失敗した場合に FALSE を返します。注意
注意: この関数は、mysqli_store_result() あるいは mysqli_query() によって取得した、 バッファに格納されている結果に対してのみ使用可能です。例
例 1379. オブジェクト指向型
<?php
/* 接続をオープンします */
$mysqli = new mysqli("localhost", "my_user", "my_password", "world");
/* 接続状況をチェックします */ 
if (mysqli_connect_errno()) {
    printf("Connect failed: %s\n", mysqli_connect_error());
    exit();
}
$query = "SELECT Name, CountryCode FROM City ORDER BY Name";
if ($result = $mysqli->query( $query)) {
    /* 行番号 400 に移動します */
    $result->data_seek(399);
    /* 行を取得します */
    $row = $result->fetch_row();
    printf ("City: %s  Countrycode: %s\n", $row[0], $row[1]);
    /* 結果セットを開放します */
    $result->close();
}
/* 接続を閉じます */
$mysqli->close();
?>
例 1380. 手続き型
<?php
/* 接続を開きます */
$link = mysqli_connect("localhost", "my_user", "my_password", "world");
/* 接続状況をチェックします */ 
if (!$link) {
    printf("Connect failed: %s\n", mysqli_connect_error());
    exit();
}
$query = "SELECT Name, CountryCode FROM City ORDER BY Name";
if ($result = mysqli_query($link, $query)) {
    /* 行番号 400 に移動します */
    mysqli_data_seek($result, 399);
    /* 行を取得します */
    $row = mysqli_fetch_row($result);
    printf ("City: %s  Countrycode: %s\n", $row[0], $row[1]);
    /* 結果セットを開放します */
    mysqli_free_result($result);
}
/* 接続を閉じます */
mysqli_close($link);
?>
上の例の出力は以下となります。
City: Benin City Countrycode: NGA
参考
| mysqli_store_result() | 
| mysqli_fetch_row() | 
| mysqli_fetch_array() | 
| mysqli_fetch_assoc() | 
| mysqli_fetch_object() | 
| mysqli_query() | 
| mysqli_num_rows() | 
Weblioに収録されているすべての辞書からmysqli_data_seek,を検索する場合は、下記のリンクをクリックしてください。
 全ての辞書からmysqli_data_seek,
                    を検索
                     全ての辞書からmysqli_data_seek,
                    を検索
                - mysqli_data_seek,のページへのリンク

 
                             
                    


