PHP.nl

cubrid_move_cursor

cubrid_move_cursor

Move the cursor in the result

bool **cubrid_move_cursor** resource $req_identifier int $offset int $origin
The  function is used to move the
current cursor location of  by the
value set in the  argument, to the direction
set in the  argument. To set the
 argument, you can use 
for the first part of the result,  for the current
location of the result, or  for the last part of the
result. If  argument is not explicitly
designated, then the function uses  as its default
value.

cubrid_move_cursor``req_identifier``offset``origin``origin``CUBRID_CURSOR_FIRST``CUBRID_CURSOR_CURRENT``CUBRID_CURSOR_LAST``origin``CUBRID_CURSOR_CURRENT

If the value of cursor movement range goes over the valid limit, then the
cursor moves to the next location after the valid range for the cursor.
For example, if you move 20 units in the result with the size of 10, then
the cursor will move to 11th place and return .

CUBRID_NO_MORE_DATA

req_identifierRequest identifier.

offsetNumber of units you want to move the cursor.

originLocation where you want to move the cursor from , , .CUBRID_CURSOR_FIRST``CUBRID_CURSOR_CURRENT``CUBRID_CURSOR_LAST

return.success

Voorbeeld: example

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

$req = cubrid_execute($conn, "SELECT * FROM code");
cubrid_move_cursor($req, 1, CUBRID_CURSOR_LAST);

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

cubrid_move_cursor($req, 1, CUBRID_CURSOR_FIRST);
$result = cubrid_fetch_row($req);
var_dump($result);

cubrid_move_cursor($req, 1, CUBRID_CURSOR_CURRENT);
$result = cubrid_fetch_row($req);
var_dump($result);

cubrid_close_request($req);
cubrid_disconnect($conn);
?>
array(2) {
  [0]=>
  string(1) "G"
  [1]=>
  string(4) "Gold"
}
array(2) {
  [0]=>
  string(1) "X"
  [1]=>
  string(5) "Mixed"
}
array(2) {
  [0]=>
  string(1) "M"
  [1]=>
  string(3) "Man"
}

cubrid_execute