Db::getPrimaryKey

Usage

?string Db::getPrimaryKey(string $table_name)

Description

Get the name of the primary key column of a database table.

Parameters

Parameter Required Type Description
$table_name Yes string The table name to get primary key column of.

Return Value

Returns the name of the primary key column, or null if the table does not have a primary key.

Examples

Get Primary Key


$table = 'admin'; $primary_key = $this->db->getPrimaryey($table); echo "Primary key of table is $primary_key\n";

See Also