[Catalyst] Insert Multiple rows - GOOD CODE

Matt S Trout dbix-class at trout.me.uk
Mon Dec 19 21:46:12 CET 2005


On Mon, Dec 19, 2005 at 12:08:32PM -0800, Will Smith wrote:
> thank you so much. That does exactly what I want to. 
>   If this is not too much, could you show me how to do that with two input text fields. I was trying to do what I've learn from you, but could not get it. Need to learn more. All I need is just another text field:
>   <input type=text name="artistid"> -- <input type=text name="artistname"> <br>
>   <input type=text name="artistid"> -- <input type=text name="artistname"> <br>
>   <input type=text name="artistid"> -- <input type=text name="artistname"> <br>
> ..
>   thank you.
>   
> 
> foreach my $artist ( @{$c->req->params->{artistid}} ) {
> my $cd = mymusic::M::CDBI::Cd->find_or_create(
> artistid => $artist
> );
  $cd->artistname(shift @{$c->req->params->{artistname}});
  $cd->update();
> }


-- 
     Matt S Trout       Offering custom development, consultancy and support
  Technical Director    contracts for Catalyst, DBIx::Class and BAST. Contact
Shadowcat Systems Ltd.  mst (at) shadowcatsystems.co.uk for more information

 + Help us build a better perl ORM: http://dbix-class.shadowcatsystems.co.uk/ +



More information about the Catalyst mailing list