PreviousNext
Help > API Functions > Native database access > i5_data_seek
i5_data_seek

 Seeks to a specific record of the result.

 

        bool i5_data_seek (resource result, int Record_Number)

 

 

Parameters

 

result

IBM i file resource.

 

record_number

Number of the record to seek to, starting from 1.

 

 

Return

 

True if OK, false if failed.

 

I5_ERR_PHP_HDLBAD

258

Bad connection handle

I5_ERR_PHP_RESOURCE_BAD

261

No resource found.

I5_ERR_PHP_TYPEPARAM

262

Type of element x in parameter -1 must be y. Type z was provided.

I5_ERR_PHP_TYPEPARAM

262

Type of element x in parameter -1 must be y. Type z was provided.

I5_ERR_PHP_NBPARAM_BAD

263

Wrong parameter count

 

 Details

 

i5_data_seek function moves internal result pointer associated to results set, presented as result (open file or request ID), to Record_Number specified line.

 

If the result set comes from a file, it's an absolute record number that may not be record position.

If it's a request, it's the n th record in the result set.

Record_Number parameter is a numeric value, from 1 to number of rows in result set.

 

This function may be used with a result obtained from i5_query, i5_open or i5_execute.

 

Example

 

 

$query = i5_query("SELECT * FROM EASYCOM/SP_CUST");

 

if (is_bool($query)) {

    $rech = i5_data_seek($query, 1) // first record

    $record = i5_fetch_row($query, I5_READ_SEEK)

(…)

 

    }

 

 

See also

 

i5_seek