maxdb_field_seek

(no version information, might be only in CVS)

maxdb_field_seek --  Set result pointer to a specified field offset

Description

Procedural style:

int maxdb_field_seek ( resource result, int fieldnr)

Sets the field cursor to the given offset. The next call to maxdb_fetch_field() will retrieve the field definition of the column associated with that offset.

Note: To seek to the beginning of a row, pass an offset value of zero.

Return values

maxdb_field_seek() returns previuos value of field cursor.

See also

maxdb_fetch_field()

Example

Example 1. Procedural style

<?php
$link
= maxdb_connect("localhost", "my_user", "my_password", "world");

/* check connection */
if (maxdb_connect_errno()) {
    
printf("Connect failed: %s\n", maxdb_connect_error());
    exit();
}

$query = "SELECT Name, SurfaceArea from Country ORDER BY Code";

if (
$result = maxdb_query($link, $query)) {

    
/* Get field information for 2nd column */
    
maxdb_field_seek($result, 1);
    
$finfo = maxdb_fetch_field($result);

    
printf("Name:     %s\n", $finfo->name);
    
printf("max. Len: %d\n", $finfo->max_length);
    
printf("Type:     %d\n\n", $finfo->type);

    
maxdb_free_result($result);
}

/* close connection */
maxdb_close($link);
?>

The above examples would produce the following output:

Name:     SurfaceArea
max. Len: 10
Type:     4