Programmatically created nodes are not appearing under table 'nodes' I have written a PHP script for the programmatic creation of nodes:

&lt;?php

define('DRUPAL_ROOT', getcwd());
$_SERVER['REMOTE_ADDR'] = "localhost";
require_once DRUPAL_ROOT . '/includes/bootstrap.inc';
drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);

// Get a list of Office ID's
$office_ids = db_query('SELECT OFFICE_ID FROM sage.OFFICE');

// Loop through and edit each user
foreach($office_ids as $office) {

  // Create a new node object
  $node = new stdClass();

  // Set our new node content type
  $node-&gt;type = "office";

  // Set the node title
  $node-&gt;title = "Office " . $office-&gt;office_id;

  // Set the language
  $node-&gt;language = LANGUAGE_NONE;

  // Set the UID of the author of the node; or use $node-&gt;name
  $node-&gt;uid = 1;

  // Set node details
  $node-&gt;body[$node-&gt;language][0]['value'] = $bodytext;
  $node-&gt;body[$node-&gt;language][0]['summary'] = text_summary($bodytext);
  $node-&gt;body[$node-&gt;language][0]['format'] = 'filtered_html';

  $path = 'office-' . $office-&gt;office_id;
  $node-&gt;path = array('alias' =&gt; $path);

  if($node = node_submit($node)) {
    node_save($node);
    echo "Node with nid" . $node-&gt;nid . " saved!\n";
  }
}


When I run the above script, I can see my NIDs incrementing (and I assume this means my nodes are created), however when I go and check in the 'nodes' table in the database, I see nothing added.

Does anything know what could be wrong?
The $node object you pass to node_save() wouldn't get it's nid member populated unless the node has been successfully saved to the node table in the database.

The auto-increment ID actually comes from the database table so if the $node object has a nid, you can pretty much guarantee the record has been successfully inserted into the table.

Make sure that the software you're using to view the table doesn't have some sort of paging turned on, meaning that only the first x number of records are actually showing in your results. Most MySQL UI software (PHPMyAdmin, Navicat, etc.) limit the number of results you see in a table by default; if you want to see more you need to change the setting.

If you want to do a quick check run the following query on your database:

SELECT MAX(nid) FROM node


Note down that number, then run your code again. Finally run the above query one more time. If the nid you get the second time around is greater than the one from the first time round, you know the record has definitely been added to the database.