List:General Discussion« Previous MessageNext Message »
From:Nelson Goforth Date:July 31 2001 6:47pm
Subject:Writing 100+ fields with Perl DBI
View as plain text  
In my application I'm writing up to 120 fields of data in one swoop 
(the results of a sort of survey).  I'm using Perl DBI with MySQL.

Each survey has several fields of data like 'name' (stored as 
parameters in the CGI object $asmt) and then up to 100 actual survey 
questions (Q1, Q2, etc).  Until now I've just written one line of 
data to a text file, like:

	# Write basic data
	print FILE asmt -> param('name') . "\t";
	print FILE asmt -> param('city') . "\t";

	$v = 1;

	#write response to each question (Q1, Q2 etc)
	while ($v <= $questions) {
		$x = "Q" . $v;
		print FILE $asmt -> param($x). "\t";
		$v++;
	}

And this works fine for the text file - but from what I've seen I 
probably can't carry over the iteration through the (up to) 100 
actual survey questions.  I named the MySQL fields 'q1', 'q2', 
anticipating some way to do a loop, but I can't see it.

Does anyone have any suggestions of how best to do this?  The thought 
of one huge INSERT statement makes my eyes glaze over - I'm hoping 
there is a more elegant alternative.

Thanks,
Nelson

-- 

===========================================================
Nelson Goforth                 Lighting for Moving Pictures
phone: 01.303.322.5042               pager: 01.303.634.9733
    resume: http://www.earthnet.net/~ngoforth/film
Thread
Writing 100+ fields with Perl DBINelson Goforth31 Jul
  • Re: Writing 100+ fields with Perl DBIDavid Mintz31 Jul
Re: Writing 100+ fields with Perl DBIWerner Stuerenburg31 Jul
  • Re: Writing 100+ fields with Perl DBINelson Goforth1 Aug