taxonomy_node_save
Definition
taxonomy_node_save($nid, $terms)
modules/taxonomy.module, line 491
Description
Save term associations for a given node.
Code
<?php
function taxonomy_node_save($nid, $terms) {
taxonomy_node_delete($nid);
if (is_array($terms)) {
foreach ($terms as $term) {
if (is_array($term)) {
foreach ($term as $tid) {
if ($tid) {
db_query('INSERT INTO {term_node} (nid, tid) VALUES (%d, %d)', $nid, $tid);
}
}
}
else if ($term) {
db_query('INSERT INTO {term_node} (nid, tid) VALUES (%d, %d)', $nid, $term);
}
}
}
}
?> 