I am new to Drupal development, work in the health care IT world, and I am stuck on how to get the nid of the just saved node in an action that I am initiating with the After Saving New Content trigger. I have a query that takes the values of the users nodes and saves some of it to a record of node author zip codes. The query works fine and it was easy to get the value of uid to use as a condition of the query but I need to limit it to the current node, not all nodes the user has created. you can see all my unsuccessful attempts between global $user and the start of the query. I'm stuck and I bet there is an easy way of getting the current nid for my $query->condition('n.nid', $node->nid); constraint.
global $user;
//node_load() $node->nid;
//$node = node_load($nid);
//$node = menu_get_object();
//$node->nid;
//$node = node_entity_info();
//entity keys] => Array ( [id] => nid [revision] => vid [bundle] => type [label] => title )
//$node->id;
//'id' => 'nid'
//$node = node_load($node->nid);
//node_load(array('nid' => $node->nid));
$node = node_load(arg(1));
$query = db_select('node', 'n');
$query->join('users', 'u', 'n.uid = u.uid');
$query->join('field_data_field_zip_author', 'z', 'u.uid = z.entity_id');
$query->addField('n', 'type', 'bundle');
$query->addField('n', 'nid', 'entity_id');
$query->addField('n', 'vid', 'revision_id');