Query: mysqli_field_seek
OS: php
Section: 3
Format: Original Unix Latex Style Formatted with HTML and a Horizontal Scroll Bar
MYSQLI_FIELD_SEEK(3) 1 MYSQLI_FIELD_SEEK(3) mysqli_result::field_seek - Set result pointer to a specified field offset Object oriented styleSYNOPSISbool mysqli_result::field_seek (int $fieldnr)DESCRIPTIONProcedural style bool mysqli_field_seek (mysqli_result $result, int $fieldnr) Sets the field cursor to the given offset. The next call to mysqli_fetch_field(3) will retrieve the field definition of the column associ- ated with that offset. Note To seek to the beginning of a row, pass an offset value of zero.PARAMETERSo $ result -Procedural style only: A result set identifier returned by mysqli_query(3), mysqli_store_result(3) or mysqli_use_result(3). o $fieldnr - The field number. This value must be in the range from 0 to number of fields - 1.RETURN VALUESReturns TRUE on success or FALSE on failure.EXAMPLESExample #1 Object oriented style <?php $mysqli = new mysqli("localhost", "my_user", "my_password", "world"); /* check connection */ if (mysqli_connect_errno()) { printf("Connect failed: %s ", mysqli_connect_error()); exit(); } $query = "SELECT Name, SurfaceArea from Country ORDER BY Code LIMIT 5"; if ($result = $mysqli->query($query)) { /* Get field information for 2nd column */ $result->field_seek(1); $finfo = $result->fetch_field(); printf("Name: %s ", $finfo->name); printf("Table: %s ", $finfo->table); printf("max. Len: %d ", $finfo->max_length); printf("Flags: %d ", $finfo->flags); printf("Type: %d ", $finfo->type); $result->close(); } /* close connection */ $mysqli->close(); ?> Example #2 Procedural style <?php $link = mysqli_connect("localhost", "my_user", "my_password", "world"); /* check connection */ if (mysqli_connect_errno()) { printf("Connect failed: %s ", mysqli_connect_error()); exit(); } $query = "SELECT Name, SurfaceArea from Country ORDER BY Code LIMIT 5"; if ($result = mysqli_query($link, $query)) { /* Get field information for 2nd column */ mysqli_field_seek($result, 1); $finfo = mysqli_fetch_field($result); printf("Name: %s ", $finfo->name); printf("Table: %s ", $finfo->table); printf("max. Len: %d ", $finfo->max_length); printf("Flags: %d ", $finfo->flags); printf("Type: %d ", $finfo->type); mysqli_free_result($result); } /* close connection */ mysqli_close($link); ?> The above examples will output: Name: SurfaceArea Table: Country max. Len: 10 Flags: 32769 Type: 4SEE ALSOmysqli_fetch_field(3). PHP Documentation Group MYSQLI_FIELD_SEEK(3)
Related Man Pages |
---|
mysqli_num_fields(3) - php |
maxdb_field_tell(3) - php |
mysqli_fetch_field_direct(3) - php |
mysqli_num_rows(3) - php |
mysqli_result.field_count(3) - php |
Similar Topics in the Unix Linux Community |
---|
AwK printf question |
Displaying Number with printf |
Awk to find duplicates in 2nd field |
Appending 1st field in a file into 2nd field in another file |
Pivoting the data |