db_column_exists

Definition

db_column_exists($table, $column)
includes/database/database.inc, line 1459

Description

Check if a column exists in the given table.

Related topics

Namesort iconDescription
Schema APIA Drupal schema definition is an array structure representing one or more tables and their related keys and indexes. A schema is defined by hook_schema(), which usually lives in a modulename.install file.

Code

<?php
function db_column_exists($table, $column) {
  return Database::getActiveConnection()->schema()->columnExists($table, $column);
}
?>
 
 

Drupal is a registered trademark of Dries Buytaert.