I am able to query the nodes linked to a specific taxonomy and generate nodes, but in my loop the nodes get over written and in the end I hav eonly the last node.
Code:
while ($node_tid = db_fetch_object($result)) {
global $user; $question->uid = $user->uid;
$question->type= 'questions'; $question->title = $node_tid->title;
// $question = node_submit($question); $question->taxonomy = $category; $question->og_groups[] = $gid;
$new_id= node_submit($question); node_save($new_id); cache_clear_all(); }
This is actually a php issue not a drupal problem. There are probably some good examples of while usage on php.net, but to point you in the right direction depending on what you want to do with this code you want to either output within the loop, append the information to a variable (that you define outside the while loop) or add the variable to an array (which you also define outside the while loop and will probably have to loop through again at some other point). Which of these you choose depends on what you're trying to accomplish.
.s
Rajaram Shyamala wrote:
I am able to query the nodes linked to a specific taxonomy and generate nodes, but in my loop the nodes get over written and in the end I hav eonly the last node.
Code:
while ($node_tid = db_fetch_object($result)) {
global $user;$question->uid = $user->uid;
$question->type= 'questions'; $question->title = $node_tid->title;
// $question = node_submit($question);$question->taxonomy = $category; $question->og_groups[] = $gid;
$new_id= node_submit($question); node_save($new_id); cache_clear_all();}