db_add_index From Online Manual

Jump to: navigation, search


$smcFunc['db_add_index'](table_name, index_info, parameters, if_exists, error)

Description: This function allows for adding an index to a table.


  • table_name an already existing table.
  • index_info an array of data as follows:
    • type (string) index type. Can be one of primary, unique, or index. Leave this entry out to keep a regular index.
    • name (string) name of index, can be left blank to use first column name.
    • columns (array) column names
  • parameters none, leave empty.
  • if_exists controls what to do if the index exists. If update (default value) updates the index but overwrites if primary, otherwise not.
  • error what to do if an error was encountered. Default: fatal.

Return: false if no columns specified.