http://www.perlmonks.org?node_id=217344

peppiv has asked for the wisdom of the Perl Monks concerning the following question:

Here's something I haven't been able to figure out (but have to, urgently).
I have this e-commerce package on our site and since I'm running the CC verification through a socket program I wrote, I also want to send this information to a DB for reporting purposes (the commerce package sucks, but alas, I don't get to make purchasing recs).
Here's the problem: The commerce program sends me transaction details through a form. Their form sends (1) transaction info - name, time, etc. (2) and transaction details - quantity 1 of product B, quantity 2 of product C, etc. Their form iterates through the transaction details, if there's more than one item per transaction, and sends the data to my program. The data is sent through set variables but as the program iterates over to the next item, it sends the info again to the same variables. Hence, if I do a single DBI INSERT I'm only collecting info on the Last item.

I thought that using a while loop might solve this problem but I'm not sure if it's the right thing to do or I've just totally screwed it up :0

inoperative code to follow

my $sql2 = qq/ INSERT INTO transaction_details (quantity, gross_sales) VALUES ($ +quantity, convert (money, $gross_sales)) /; while (<>) { my $quantity = param("quantity"); $quantity = $dbh->quote( $quantity ); my $gross_sales = param("gross_sales"); $gross_sales = $dbh->quote( $gross_sales ); my $rv = $dbh->do( $sql2 ); }
I get no errors. I just know that I'm not passing any data to this table (I pass other data to another table earlier in the program so I'm sure the DB connection works). Can I accept variables passed through a form to this script in a while statement?

Any suggestions or quick pointers to where I'm falling down would be appreciated.

Supa Thanx, for any help

peppiv