I used "date" to keep things simple here. :) The actual statement looks like this:
my $sth_1 = $dbh->prepare("SELECT sum(EMAIL_IRT),sum(DROP_CALL_COUNT), +sum(ANS_CALL_COUNT),sum(EMAILS_IN),sum(EMAILS_OUT) FROM CS_STATS WHER +E DATE_ADDED LIKE ?");
Also, I removed the row->0 if statement completely but still have the same problem - it looks like nothing is returned. This is what I have now:
my $sth_1 = $dbh->prepare("SELECT sum(EMAIL_IRT),sum(DROP_CALL_COUNT), +sum(ANS_CALL_COUNT),sum(EMAILS_IN),sum(EMAILS_OUT) FROM CS_STATS WHER +E DATE_ADDED LIKE ?"); $sth_1->execute($date_1) or die "Couldn't get values from DB: " . DBI- +>errstr; $sth_1->execute(); my ($email_irt,$drop_call_count,$ans_call_count,$emails_in,$emails_out +); while (my @data = $sth_1->fetchrow_array()) { $email_irt = $data[0]; $drop_call_count = $data[1]; $ans_call_count = $data[2]; $emails_in = $data[3]; $emails_out = $data[4]; } print "$email_irt,$drop_call_count,$ans_call_count,$emails_in,

And this is the output:

Use of uninitialized value $email_irt in concatenation (.) or string a +t monthly_stat_mailer.pl line 88. Use of uninitialized value $drop_call_count in concatenation (.) or st +ring at monthly_stat_mailer.pl line 88. Use of uninitialized value $ans_call_count in concatenation (.) or str +ing at monthly_stat_mailer.pl line 88. Use of uninitialized value $emails_in in concatenation (.) or string a +t monthly_stat_mailer.pl line 88. Use of uninitialized value $emails_out in concatenation (.) or string +at monthly_stat_mailer.pl line 88. ,,,,

In reply to Re^2: Problem passing date to SQL by JoeTheProgrammer
in thread Problem passing date to SQL by JoeTheProgrammer

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.