mysql_fetch_field(result,[offset])

Description: Gets column information from a result given by result and returns as an object.

Returns information about the fields in a query result. The integer offset is used to specify the field, but if not specified, information is returned about the next field that has not already been reported on by mysql_fetch_field().

The object returned has the following properties:

  • name— The column name

  • table— The name of the table to which the column belongs

  • not_null— Set to 1 if the column is NOT NULL

  • primary_key— Set to 1 if the column is the primary key

  • unique_key— Set to 1 if the column is a unique key

  • multiple_key— Set to 1 if the column is a non-unique key

  • numeric— Set to 1 if the column is a numeric type

Get Sams Teach Yourself MySQL in 21 Days, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.