Call to undefined function node_load_multiple() function my_module_getcategory() {
  $nodes = node_load_multiple(db_query('SELECT nid FROM {node}')-&gt;fetchCol());
  $data = array();

  foreach ($node as $nid) {
    print $nid;
    $data[$nid] = drupal_render(node_view($nid, 'full'));
  }

  $json = drupal_json_encode($data);
}


The above code give me the following error:


  Fatal error: Call to undefined function node_load_multiple() in C:\xampp\htdocs\new_task\sites\all\modules\my_module\my_module.module on line 5


How can I fix this error? I verified the Node module is enabled.
If you call node_load_multiple() from hook_boot(), then the function is not found because at the time hook_boot() is invoked, only the modules implementing it are loaded. Once Drupal completes the bootstrap, all the enabled modules are loaded, and you can call every function implemented by those modules.

The same is true when you call node_load_multiple() from your own PHP file that doesn't bootstrap Drupal before to call any Drupal functions.

Suppose that you have a example.php file that is invoked as http://example.com/example.php; if the file doesn't contain the following code, then Drupal will not bootstrap, and every Drupal function is not available.

define('DRUPAL_ROOT', getcwd());

require_once DRUPAL_ROOT . '/includes/bootstrap.inc';
drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);


In other cases, you should not get the error you are getting. The only possibility is that the node.module file got corrupted when it was copied, but at that point I would expect something else to not work too; for example, if the content of node.module is corrupted, and  node_load_multiple() is read as ode_load_multiple(), then you would get the same error when you are looking at a node page (e.g., http://example.com/node/1).

As side note, hook_boot() has been removed from Drupal 8; if you are using that hook in Drupal 7, you will need to change your code, since it would not work anymore with Drupal 8.