Where is data from CCK fields stored in database?

We encourage users to post events happening in the community to the community events group on https://www.drupal.org.
PixelClever's picture

m working on a module that requires information from a CCK date field in Drupal 6. In version 5 the cck data was stored by content type, but now I can't figure out where it is. Can anyone tell me which table I would look at to find CCK data, specifically data from the date field module?
Any tips are appreciated... thanks.

Comments

HI, it should be in

ferda's picture

HI, it should be in content_type_yourtype table. Works for D6.

Unless you allow more than

jthaxton's picture

Unless you allow more than one field... then their will be a table specifically for that field outside of the content type table. At least that is the behaviour I have noticed and it makes sense to allow infinite fields of a particular type.

to revive this post: you can

petrica.martinescu's picture

to revive this post:
you can use the following functions to find more information about where the cck field is stored in database:

$field = content_fields('field_example');
$db = content_database_info($field);

where 'field_example' is the name of your cck field.

this will give you the table name, field name and data type for 'field_example'.

If you are looking for the

incaic's picture

If you are looking for the allowed values of a list widget you can find them in he content_node_field table.

One way to obtained the array list is:

<?php
$field
= "SELECT * FROM {content_node_field} AS f WHERE f.field_name='%s'";
$array_list = content_allowed_values(unserialize($field->global_settings));
?>

content_allowed_values is a function in cck/content.module

For D7 this worked for me

erinclerico's picture

function mymodule_get_list_from_field ($field_name) {
  $field_data = field_info_field($field_name);
  return ($field_data['settings']['alowed_values']);
}