Moves current position to a specific record in file.
Syntax N° 1
|
bool i5_seek ( |
resource file , |
Syntax N° 2
|
bool i5_seek ( |
resource file , |
This function moves result pointer to the record witch indexed values meet table specified parameters.
This function is typically used to search in a file according to a key (simple or composite). It locates the record that fills the specified requirement for a defined index.
See functions i5_range_from and i5_range_to to select a range of records.
i5_seek moves the pointer without reading the result, next call to i5_fetch_xxxx will return the line.
|
File |
i5 file resource. | ||
|
operator |
Comparison operator. Position is set to first record satisfying the operator. Operator can be specified as a symbolic or string value. | ||
|
|
Symbolic value |
String value |
Description |
|
|
I5_EQ |
"=" |
Equal |
|
|
I5_GE |
">" |
Greater than |
|
|
I5_GT |
">=" |
Greater or Equal |
|
|
I5_LT |
"<" |
Less than |
|
|
I5_LE |
"<=" |
Less or Equal |
|
|
I5_FIRST |
"FIRST" |
First record: No key value is required. |
|
|
I5_LAST |
"LAST" |
Last record: No key value is required. |
|
|
I5_BOOKMARK |
"BOOKMARK" |
Go to record number |
|
Keyvalue |
values of the keys to locate to.
| ||
|
Last_field_len |
Length of the last field. If "Last_field_len" is omitted, the last given key field will be considered in its full size. If "Last_field_len" has special value I5_ACTUAL_SIZE, the current contain size of the cell in "keyvalue" array, will be considered for the last field.
| ||
Returns:
True if OK, false if failed.
Error returned
|
I5_ERR_PHP_HDLDFT |
256 |
No default connection found. |
|
I5_ERR_PHP_OPTIONSTYPE |
259 |
The type of " I5_OPTIONS_ALIAS" option must be x and not x |
|
I5_ERR_PHP_OPTIONSNUMBER |
260 |
Option number -1 is unknown. |
|
I5_ERR_PHP_TYPEPARAM |
262 |
Type of element x in parameter -1 must be y. Type z was provided. |
|
I5_ERR_PHP_TYPEGET |
264 |
The x function is unable to translate this type (-1). |
|
I5_ERR_PHP_OPERATOR_BAD |
265 |
Unknown operator (x) |
|
I5_ERR_FIELDNULL |
4097 |
Field value is NULL |
$file = i5_open('EASYCOM/NCLIENT');
/* Looking for MARTIN */
$seek = array("MARTIN");
/* Looking for martin pierre*/
//$seek = array("MARTIN ", "PIERRE");
$ret = i5_seek($file, "=", $seek);
$rec = i5_fetch_row($file, I5_READ_SEEK);
/* Set a bookmark on current record */
$dupont = i5_bookmark($file);
[... others treatments on the file ...]
/* Direct return to back to DUPONT record */
$ret = i5_data_seek($file, $dupont);
$rec = i5_fetch_row($file, I5_READ_SEEK);
print_r($rec);echo "<BR>";