Problem by creating nodes in loop
Objects are passed by reference in PHP; therefore $node-&gt;nid is being set after your first go around the for loop. If $node-&gt;nid is set, no new node is created, so, I'd unset($node-&gt;nid) after each node_save() and give it another try.