Closed (fixed)
Project:
Computed Field
Version:
5.x-1.2
Component:
Code
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Reporter:
Created:
21 May 2008 at 20:15 UTC
Updated:
21 May 2008 at 20:26 UTC
I'm trying to get the computed field to look up the titles and nids of content_type, check to see if the title matches the title that was selected in my "first field" field ($node->field_first_field[0]['value']) and if it does, set the value of the computed field to the nid of that title's node.
I got it to work (printed out the nid) in a block and I can't figure out why it won't work in computed field. Is something about my code off? Am I missing something else?
$result = db_query(
"SELECT title, nid
FROM {node} n
WHERE n.status = 1
AND n.type = 'content_type'"
);
while ($row = db_fetch_array($result)) {
$targetNid = $row['nid'];
$testTitle = $row['title'];
if ($node->field_first_field[0]['value'] == $testTitle) {
$output = $targetNid;
}
}
$node_field[0]['value'] = $output;
Comments
Comment #1
pog-wmt commentedBah. My normal type of mistake: a painfully simple one. I resaved the node.