kevsurf has asked for the wisdom of the Perl Monks concerning the following question:
I have a complicated question and it is mainly about how to process the data after I get it out of the database.
Here's what I have....
I have a CGI that has about 7 checkboxes in it ( a checkbox group). When submitted it sends an array of the checkboxes that were checked in a variable.....
So if "Edte, Ecpp, Excdr and Eab" were checked, I'd get them back as the array values.
These values tell me which fields of my query are to be displayed, so I setup a hash to correspond to the field in the database, as a few of them represent more than one field....
Now, by doing something like the following, I could put the fields into an array and then give that array to one of the DBI functions and it would spit out the values of each of these fields.%dbfield = ( 'Edte' => [DATE], 'Ecpp' => [CPP], 'Excdr' => [XCDR], 'Eab' => [ACCESS_BTS, ACCESS_SECTOR, ACCESS_CHANNEL] );
foreach $thing (keys %dbfield) { print "the members of $thing are:\n"; foreach (@{$dbfield{$thing}}) { print "\t$_\n"; } }
I need to perform caclulations on the values as they come out of the database....does anyone know of a way to automate this.
I've thought of:
Other than that, I'm not sure how to go about this.#db connect, prepare, exectute goes here.... while($ref = $sth->fetchrow_hashref()) { foreach $opt (@enable_opts) { #@enable_opts is the array of checkbox v +alues #switch statement to perform calculations on values ($ref{'DATE'}) } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Processing DBI query results
by RMGir (Prior) on Jun 18, 2002 at 20:41 UTC | |
|
Re: Processing DBI query results
by rdfield (Priest) on Jun 19, 2002 at 13:13 UTC |