Hello all,

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....

%dbfield = ( 'Edte' => [DATE], 'Ecpp' => [CPP], 'Excdr' => [XCDR], 'Eab' => [ACCESS_BTS, ACCESS_SECTOR, ACCESS_CHANNEL] );
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.
foreach $thing (keys %dbfield) { print "the members of $thing are:\n"; foreach (@{$dbfield{$thing}}) { print "\t$_\n"; } }

Ok, now that that is all said.....we can get to the actual problem.....

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:

#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'}) } }
Other than that, I'm not sure how to go about this.
Any help is appreciated....
Kevin

In reply to Processing DBI query results by kevsurf

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.