mysqli_data_seek
    (PHP 5)
mysqli_data_seek
    (no version information, might be only in CVS)
result->data_seek -- 結果の任意の行にポインタを移動する
説明
手続き型:
bool 
mysqli_data_seek ( mysqli_result result, int offset )
オブジェクト指向型(メソッド):
class 
mysqli_result { 
bool 
data_seek ( int offset )
}
     mysqli_data_seek() 関数は、result
     があらわす結果の任意の行 offset にポインタを移動します。
     offset は、ゼロから全行数 - 1 までの間
     (0..mysqli_num_rows() - 1)である必要があります。
    
返り値
     成功した場合に TRUE を、失敗した場合に FALSE を返します。
    
例
例 1. オブジェクト指向型 
<?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(); ?>
 |  
  | 
例 2. 手続き型 
<?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  |