You are viewing a plain text version of this content. The canonical link for it is here.
Posted to embperl@perl.apache.org by Jon Brisbin <br...@ipa.net> on 2000/08/07 05:10:29 UTC

multiple records from a textarea

How would be the best way to use DBIx::Recordset to insert multiple records
of data like such:

I have a textarea that will contain a list of items, one per line, separated
by newlines...the other data on the page (category, etc...) will remain the
same, but I need to insert a record for every row of items...how should I do
this using DBIx::Recordset??

I've tried several methods, including split()ing the $fdat{'items'} field on
newlines and doing an Insert{\%fdat}in a foreach $item (@items) loop...this
just succeeds in putting NULL's and 0's in every field...once for every item
:-)

Any suggestions or help would be appreciated! :-)

Jon Brisbin




Re: multiple records from a textarea

Posted by Gerald Richter <ri...@ecos.de>.
> that did it! :-)  i just needed the "\r"...what's that character??
> 

it's called "carridge return"

Gerald


-------------------------------------------------------------
Gerald Richter    ecos electronic communication services gmbh
Internetconnect * Webserver/-design/-datenbanken * Consulting

Post:       Tulpenstrasse 5         D-55276 Dienheim b. Mainz
E-Mail:     richter@ecos.de         Voice:    +49 6133 925151
WWW:        http://www.ecos.de      Fax:      +49 6133 925152
-------------------------------------------------------------




Re: multiple records from a textarea

Posted by Jon Brisbin <br...@ipa.net>.
that did it! :-)  i just needed the "\r"...what's that character??

Jon Brisbin

----- Original Message -----
From: Sherwin Daganato <wi...@email.com.ph>
To: <br...@ipa.net>; <em...@perl.apache.org>
Sent: Monday, August 07, 2000 4:30 AM
Subject: Re: multiple records from a textarea


> how about...
> [$ foreach $n ( split(/\r\n/, $fdat{items}) ) $]
>   do something with $n...
> [$ endforeach $]
>
> sherwin
>
> brisbin@ipa.net writes:
> >How would be the best way to use DBIx::Recordset to insert multiple
> >records
> >of data like such:
> >
> >I have a textarea that will contain a list of items, one per line,
> >separated
> >by newlines...the other data on the page (category, etc...) will remain
> >the
> >same, but I need to insert a record for every row of items...how should I
> >do
> >this using DBIx::Recordset??
> >
> >I've tried several methods, including split()ing the $fdat{'items'} field
> >on
> >newlines and doing an Insert{\%fdat}in a foreach $item (@items)
> >loop...this
> >just succeeds in putting NULL's and 0's in every field...once for every
> >item
> >:-)
> >
> >Any suggestions or help would be appreciated! :-)
> >
> >Jon Brisbin
>
>


Re: multiple records from a textarea

Posted by Sherwin Daganato <wi...@email.com.ph>.
how about...
[$ foreach $n ( split(/\r\n/, $fdat{items}) ) $]
  do something with $n...
[$ endforeach $]

sherwin

brisbin@ipa.net writes:
>How would be the best way to use DBIx::Recordset to insert multiple
>records
>of data like such:
>
>I have a textarea that will contain a list of items, one per line,
>separated
>by newlines...the other data on the page (category, etc...) will remain
>the
>same, but I need to insert a record for every row of items...how should I
>do
>this using DBIx::Recordset??
>
>I've tried several methods, including split()ing the $fdat{'items'} field
>on
>newlines and doing an Insert{\%fdat}in a foreach $item (@items)
>loop...this
>just succeeds in putting NULL's and 0's in every field...once for every
>item
>:-)
>
>Any suggestions or help would be appreciated! :-)
>
>Jon Brisbin