I have recently used node reference on a Drupal 5 install. And the problem occurs when you are not logged in, in the function: nodereference_field_formatter in nodereference.module line: 188

if (!isset($titles[$item['nid']])) {
    if ($title = db_result(db_query(db_rewrite_sql("SELECT title FROM {node} WHERE nid=%d"), $item['nid']))) {
      $titles[$item['nid']] = $title ? $title : '';
    }
  }

During the rewrite, it adds node_access joins, wich will result in MySQL returning "ambiguous nid in your query.".
Replace the above code with:

if (!isset($titles[$item['nid']])) {
    if ($title = db_result(db_query(db_rewrite_sql("SELECT title FROM {node} n WHERE n.nid=%d"), $item['nid']))) {
      $titles[$item['nid']] = $title ? $title : '';
    }
  }

I hope this gets ported in new releases.

Gabriel

Comments

longwave’s picture

Status: Needs review » Closed (duplicate)