[support] I need to create multiple CCk nodes as an action.
sander-martijn
lists at severeddreams.com
Mon Oct 22 13:58:39 UTC 2007
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();
> }
>
More information about the support
mailing list