phpBB

Development Wiki

Umil.table column exists

From phpBB Development Wiki

umil::table_column_exists –– Check if a column exists on a database table using the Umil Library.

Description

string umil::table_column_exists ( string $table_name, string $column_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_
column_name Required The name of the column to check for

Return Values

True if the column on the database table exists
False if the column on the database table does not exist

Examples

Example #1

Check if a column named 'test_id' exists on the database table named 'phpbb_test'

$umil->table_column_exists('phpbb_test''test_id');

Example #2

Check if a column named 'user_foo' exists on the database table named 'phpbb_users'

$umil->table_column_exists(USERS_TABLE'user_foo');

See Also