PHP mysqli_fetch_fields() Function

Object oriented style

array mysqli_result::fetch_fields ( void )

Procedural style

array mysqli_fetch_fields ( mysqli_result $result )

This function serves an identical purpose to the mysqli_fetch_field() function with the single difference that, instead of returning one object at a time for each field, the columns are returned as an array of objects.The mysqli_fetch_fields() function returns an array of objects that represent the fields (columns) in a result set.

Examples -

Object oriented style

Procedural style

The above examples will output:

====================== Character Set: latin1 ======================

Name: actor_id Table: actor Max. Len: 3 Length: 5 charsetnr: 63 Flags: 49699 Type: 2

Name: last_name Table: actor Max. Len: 12 Length: 45 charsetnr: 8 Flags: 20489 Type: 253

====================== Character Set: utf8 ======================

Name: actor_id Table: actor Max. Len: 3 Length: 5 charsetnr: 63 Flags: 49699 Type: 2

Name: last_name Table: actor Max. Len: 12 Length: 135 charsetnr: 33 Flags: 20489

ParameterDescription
resultProcedural style only: A result set identifier returned by mysqli_query(), mysqli_store_result() or mysqli_use_result().

Return Values

Returns an array of objects which contains field definition information or FALSE if no field information is available.