我已经成功地从数据库中删除了节点(我检查了它),但问题是节点引用字段中的 nid 不会消失。我该如何删除这个?这是我的代码,它不起作用
if($op == 'delete' && $node->type == 'person'){
$id = $node->nid;
$q=db_query("select nid from content_field_movie_cast where field_movie_cast_nid = '$id'"); //get all the movie ids that have the cast
db_query("DELETE from content_field_movie_cast where field_movie_cast_nid = '$id' "); // delete all the entry for that cast in a all the movies it is involve
while($result=db_fetch_array($q)){
$node1=node_load($result['nid']);
$ctr=0;
$cnt=count($node1->field_movie_cast);
while($ctr<$cnt){
if($node1->field_movie_cast[$ctr]['nid']==$id){
dpm($node1->field_movie_cast[$ctr]['nid']=0);
node_delete($nid);
}
$ctr++;
}
db_query("update content_type_movie set field_movie_cast_count_value =field_movie_cast_count_value -1 where nid = '".$result['nid']."' ");
}
}
这里还有一张图片,我在谈论没有名字的 nid 是我要删除的那个