db_field_names
Definition
db_field_names($fields)
includes/database.inc, line 529
Description
Return an array of field names from an array of key/index column specifiers.
This is usually an identity function but if a key/index uses a column prefix specification, this function extracts just the name.
Parameters
$fields An array of key/index column specifiers.
Return value
An array of field names.
Related topics
| Name | Description |
|---|---|
| Schema API | A 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_field_names($fields) {
$ret = array();
foreach ($fields as $field) {
if (is_array($field)) {
$ret[] = $field[0];
}
else {
$ret[] = $field;
}
}
return $ret;
}
?> 