Returns information about all the columns in a table.


mixed smf_db_list_columns (string $table_name[, bool $detail[, array $parameters]])

Parameter $table_name

Expected type: String
Description: The name of the table to get columns for

Parameter $detail

Expected type: Boolean
Description: If true, the function will return an array containing arrays of information about each column. Otherwise the function will return an array of column names. Default is false.

Parameter $parameters

Expected type: Array
Description: An array of parameters

Array Elements of $parameters
Key Optional Expected type Description
no_prefix yes Boolean If true, SMF won't add the db_prefix to the table name

Return value

Expected type: Mixed
Description: An array of column names or an array of arrays of column data

Possible types
Allowed values Description
Array An array of column names (if $detail is false)
Array of arrays An array of arrays of column data (uses numeric indexes)


  • Returns an array containing either column names or arrays of info about the columns
  • If $detail is true, each array of column data will have the following keys: 'name' (column name), 'null' (whether or not the column can be null (boolean)), 'default' (default value for the column or null if it doesn't have one), 'type' (data type), 'size' (column size) and 'auto' (whether or not this is an auto-incrementing column (boolean))
View all versions of this function