0

I have a content type called user registration under this one cck field called regid. i would like to fetch the entered values of this particular field through programmatically probably by using dbquery() functions and print it. Anyone guide me how to achieve it.

1
  • possible duplicate of Programmatically get field values - i know it's not about db_query, but you wrote probably. And field_get_items is much better way to do it.
    – Mołot
    Commented Jul 5, 2015 at 8:35

1 Answer 1

1

Here is a little example, how to make requests in Drupal 6. You may change table name and field name and it should work for you.

$query = db_query('SELECT n.nid, regid.regid_FIELD_VALUE
   FROM {node} AS n
   JOIN {regid_FEILD_TABLE_NAME} AS regid ON regid.vid = n.vid 
   WHERE n.type = %s AND n.status = %d, $your_node_type, 1);

$result = array();
while($node_data = db_fetch_object($query)) {
  $result[] = array(
    'nid' => $node_data->nid,
    'regid' => $node_data->regid_FIELD_VALUE,
  );
}
2

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.