How to get the NodeID from ItemID of connect Item from Field Collection
you may want to try hostEntity() method (link)


  Returns the host entity, which embeds this field collection item.


Then you'll be able to extract nid from the result returned by hostEntity().

but it is not clear what are you loading with field_collection_item_load($did); 

is $did the id of the field_collection item - meaning the field collection and not the field in it? if so, than you can do something like this

$entity = entity_load_single('field_collection_item', $did);
$host_entity = $entity-&gt;hostEntity();
$nid = $host_entity-&gt;nid;  // returns node id of the node that hosts given field collection