getting data from a nodereferrer

Last modified: October 25, 2008 - 07:25

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!

 
 

Drupal is a registered trademark of Dries Buytaert.