Same name and namespace in other branches
  1. 4.6.x developer/examples/node_example.module \node_example_insert()
  2. 5.x developer/examples/node_example.module \node_example_insert()

Implementation of hook_insert().

As a new node is being inserted into the database, we need to do our own database inserts.

1 call to node_example_insert()
node_example_update in developer/examples/node_example.module
Implementation of hook_update().

File

developer/examples/node_example.module, line 181
This is an example outlining how a module can be used to define a new node type.

Code

function node_example_insert($node) {
  db_query("INSERT INTO {node_example} (vid, nid, color, quantity) VALUES (%d, %d, '%s', %d)", $node->vid, $node->nid, $node->color, $node->quantity);
}