Advertising sustains the DA. Ads are hidden for members. Join today

Computed Field

getting data from a nodereferrer

Last updated on
30 April 2025

You are browsing documentation for an older version of Drupal, which is not supported any longer, and the information may not be correct. See current documentation for Contributed modules

I have the nodereferrer module installed and want to use data in a field in the node that refers to this node. This is the code I used

$r= db_result(db_query("SELECT `nid`FROM `content_field_recordingparts`WHERE `field_recordingparts_nid` = %d",$node->nid)); 
$node_field[0]['value'] = db_result(db_query("SELECT field_recordingid_value FROM content_type_recording_data WHERE nid=%d",$r)) . "." . $node->field_recordingnum[0]['value'];

recordingdata has a node reference set up on recordingparts, and the reference between the recordingdata nodes (nid) and recordingparts nodes (field_recordingparts_nid) is stored in a table called content_field_recordingparts. The data I want is in the recordingid field on the recordingdata node, and I want to append a "." and the value of another field in the current node.

hope this makes sense and is helpfull to others. I'd be interested if there was a simpler way of doing this!

Help improve this page

Page status: Not set

You can: