hook_update

Definition

hook_update($node)
developer/hooks/node.php, line 282

Description

Respond to node updating.

This is a hook used by node modules. It is called to allow the module to take action when an edited node is being updated in the database by, for example, updating information in related tables.

To take action when nodes of any type are updated (not just nodes of the type(s) defined by this module), use hook_nodeapi() instead.

For a detailed usage example, see node_example.module.

Parameters

$node The node being updated.

Return value

None.

Related topics

Namesort iconDescription
HooksAllow modules to interact with the Drupal core.

Code

<?php
function hook_update($node) {
  db_query("UPDATE {mytable} SET extra = '%s' WHERE nid = %d",
    $node->extra, $node->nid);
}
?>
 
 

Drupal is a registered trademark of Dries Buytaert.