略微加速

PHP官方手册 - 互联网笔记

PHP - Manual: cubrid_data_seek

2025-02-27

cubrid_data_seek

(PECL CUBRID >= 8.3.0)

cubrid_data_seekMove the internal row pointer of the CUBRID result

说明

cubrid_data_seek(resource $result, int $row_number): bool

This function performs the moving of the internal row pointer of the CUBRID result (associated with the specified result identifier) to point to a specific row number. There are functions, such as cubrid_fetch_assoc(), which use the currently stored value of row number.

参数

result

The result.

row_number

This is the desired row number of the new result pointer.

返回值

Returns true on success or false on failure.

示例

示例 #1 cubrid_data_seek() example

<?php
$conn
= cubrid_connect("127.0.0.1", 33000, "demodb");

$req = cubrid_execute($conn, "SELECT * FROM code");
cubrid_data_seek($req, 0);

$result = cubrid_fetch_row($req);
var_dump($result);

cubrid_data_seek($req, 2);
$result = cubrid_fetch_row($req);
var_dump($result);

cubrid_data_seek($req, 4);
$result = cubrid_fetch_row($req);
var_dump($result);

cubrid_close_request($req);
cubrid_disconnect($conn);
?>

以上示例会输出:

array(2) {
  [0]=>
  string(1) "X"
  [1]=>
  string(5) "Mixed"
}
array(2) {
  [0]=>
  string(1) "M"
  [1]=>
  string(3) "Man"
}
array(2) {
  [0]=>
  string(1) "S"
  [1]=>
  string(6) "Silver"
}
添加备注

用户贡献的备注

此页面尚无用户贡献的备注。

官方地址:https://www.php.net/manual/en/function.cubrid-data-seek.php

北京半月雨文化科技有限公司.版权所有 京ICP备12026184号-3