By modul on
Hi all,
Judging from my many questions on this forum, you may correctly infer that I'm a newbie :-) So, if it's yet another silly problem I'm throwing in the group, excuuuuuse me...
I made a CCK field called "department". Now I have to apply some home-grown code on its values, but I can't figure out where Drupal 5.1 stores them.
I'd like to retrieve them in a simple query like "select * from {FROM_WHAT??} where department = 'something'", but I don't know how to address the table or the field. Any hints would be Greatly appreciated.
Ludo
Comments
CCK Handbook page:
For pulling individual fields, see CCK Handbook page: http://drupal.org/node/62485
For getting a list of (possibly different) fields, see the views.module profile page: http://drupal.org/project/views
Oh my, those CCK Handbook
Oh my, those CCK Handbook pages look a wee bit daunting...
Is there no "simpler" way to retrieve CCK fields, with a "simple" SQL statement:
$query = '"select * from {something} where my_cck_field = "whatever"' ?
My main problem is: what is this "{something}" ?? Where are CCK fields stored, and can they be accessed as regular MySQL tables?
Ludo
Fhe cck-fields are "stored"
Fhe cck-fields are "stored" in the database, however are made available for theming in the "$node" array (to print out all available information of that array, put
<?php print_r ($node) ?>somewhere in your node-type.tpl.php file in your theme directory, where type is the machine-readable name of your content type). The names of the cck fields are displayed in the "content type" administration section of your content type, try the different tabs.For example, if one of your cck-fields is called "field_something" then you would first check if that field has in fact any content and then display that content as so:
or, if you have more than one entry per field (which is sometimes necessary), you would display the multiple entrys per field:
Thanks for your reply,
Thanks for your reply, JSToeckler.
- Your reply shows me how to deal with CCK fields on a node level.
- I also know that I can run queries (in Drupalingo: Views) on them.
But is it also possible to deal with CCK fields in custom made SQL queries? I probably could design a View to, for instance, "select all CCK-Authors with CCK-Age > 50 and CCK-Number-of-Articles < 50 unless it's Tuesday and order them by the second letter of their name", but when you have a bit of experience in SQL coding, things like that are done Much faster in code.
Maybe I'm fighting Drupal here (I'm using 5.1), instead of working with it, but when queries are concerned, I like to know that I am not constrained by "the system".
So, is this possible? Can I address CCK fields in home-cooked SQL queries?
Ludo
hi again, i suppose it's
hi again,
i suppose it's possible, but since i a) am not nearly an expert on anything concerning drupal and b) neither know much about sql-queries, i guess you'll have to wait and hope for someone more knowledgable to answer.
I'm looking at my database
I'm looking at my database right now, and it appears the information is located under one of the tables prefixed with "content_type_". The suffix refers to the actual content type. (i.e. content_type_page) I'm using Drupal 5.x.
Drupal's so easy, even I could do it.
http://www.kfol.org/
Checking before node saved
Hi,
Interesting thread. My interest is : Is it possible to capture the input values even before saving/submitting(ie saving to the database tables). For example, if the user selects a checkbox, could I capture the value clicked.....or the item selected in a select list.....or a taxonomy terr selected in the select list ?? ...could this be done??