Executing PHP code only once, when the node is created I am using Drupal 7 with  the Token module.
I wrote PHP code using the token field that can satisfy loading a specific node, updating some field values, and saving the node (using node functions).  

When editing this node the code run again; I just want to run this code when creating this node. How can I do that?
You should use hook_node_insert in a custom module to run your code when the node is created.

function hook_node_insert($node) {
  // To include @marcvangend's comment.
  if ($node-&gt;type == 'type') {
    // Run code here only for node of type 'type'.
  }
  // Run code here for all nodes...
}