[Catalyst] Insert Multiple rows

Will Smith willbelair at yahoo.com
Mon Dec 19 17:31:30 CET 2005


Thank you,
  That's exactly what I am trying to do. I did the same thing, but could not get the result. I guess because I used the wrong function
  Could I use this (obviously not, because I got error): for example, I have 2 boxes named artistid
  sub do_insert : Local {
    my ( $self, $c ) = @_;
    my $artist = $c->req->param('artistid'); ##  if I use the params (instead of param) I will get the value as column name instead
    my $myvar;
    for ($myvar=0;$myvar<2;$myvar++)
    {
    my $cd = mymusic::M::CDBI::Cd->find_or_create(artistid => $artist); # the error is here , I get only 1 row created instead of 2 as desired. When tried to use ->create only, it says need to get hash ....  so I changed to : my %hash = (artistid => $c->req->param('artistid')); and still get error
    }
    
    $c->stash->{template} = 'Cd/list.tt';
  }
   
  If you could, please point out the wrongness here, which function should I use to get the result. And of course I have not only the artistid on the TT, what do I need to do for the whole form such as:
  <input name="artistid" value="[% myobject.artistid %]"> ... <input name="artistname" value="[% myobject.artistname %]">
    <input name="artistid" value="[% myobject.artistid %]"> ... <input name="artistname" value="[% myobject.artistname %]">
    <input name="artistid" value="[% myobject.artistid %]"> ... <input name="artistname" value="[% myobject.artistname %]">
  ......
   
  Thank you for your kindness



__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.rawmode.org/pipermail/catalyst/attachments/20051219/7d70a415/attachment.htm


More information about the Catalyst mailing list