You are here

function _nodehierarchy_get_next_child_order in Node Hierarchy 5

Same name and namespace in other branches
  1. 6 nodehierarchy.module \_nodehierarchy_get_next_child_order()

Get the next valid sort order for the given parent.

1 call to _nodehierarchy_get_next_child_order()
nodehierarchy_insert_node in ./nodehierarchy.module
Insert or update a node. Set it's parent

File

./nodehierarchy.module, line 925
A module to make nodes hierarchical.

Code

function _nodehierarchy_get_next_child_order($parent_nid) {
  $order_by = -1;
  $result = db_query("SELECT h.order_by FROM {nodehierarchy} h WHERE h.parent = %d ORDER BY h.order_by DESC LIMIT 1", $parent_nid);
  if ($order = db_fetch_array($result)) {
    $order_by = $order['order_by'];
  }
  return $order_by + 1;
}