Umil.table index exists
From phpBB Development Wiki
umil::table_index_exists –– Check if an index/key exists on a database table using the Umil Library.
This can not check for Primary or Unique columns.
Contents |
Description
string umil::table_index_exists ( string $table_name, string $index_name )
Parameters
| Parameter | Required/Default | Usage |
|---|---|---|
| table_name | Required | The name of the database table to check. You may just use phpbb_ for the table prefix if you would like. UMIL correctly sets the table prefix to the board's default if you enter in phpbb_ |
| index_name | Required | The name of the index/key to check for |
Return Values
True if the index/key on the database table exists
False if the index/key on the database table does not exist
Examples
Example #1
Check if an index named 'test_id' exists on the database table named 'phpbb_test'
$umil->table_index_exists('phpbb_test', 'test_id');
Example #2
Check if an index named 'user_foo' exists on the database table named 'phpbb_users'
$umil->table_index_exists(USERS_TABLE, 'user_foo');
See Also

