The programs pulls a symbol from a table and then uses that symbol to lookup other values, everything works well except for the last statement where I try to insert that data into another table where I get the "die"

#!/usr/bin/perl # PERL MODULES WE WILL BE USING # use strict; # use warnings; # use diagnostics; use DBI; use DBD::mysql; use Finance::Quote; use Data::Dumper; # CONFIG VARIABLES my $platform = "mysql"; my $database = "foci"; my $host = "localhost"; my $port = "3306"; my $user = "cparrett"; my $pw = "cayman"; my $DIVTABLE="dividends"; # DATA SOURCE NAME my $dsn = "dbi:mysql:$database:localhost:3306"; # PERL DBI CONNECT my $connect = DBI->connect($dsn, $user, $pw)or die "NOT WORKING"; # PREPARE THE QUERY To GET SYMBOL FROM SECTORS TABLE my $GET_SYMBOLKEY = "SELECT SYMBOL FROM sectors"; my $SYMBOLKEY = $connect->prepare($GET_SYMBOLKEY ); # EXECUTE THE QUERY, ONLY NEED TO EXECUTE ONCE $SYMBOLKEY->execute(); my $symbol; # BIND TABLE COLUMN SYMBOL TO VARIABLES $symbol $SYMBOLKEY->bind_columns(undef,\$symbol); # DEFINE A QUERY TO INSERT DATA INTO DIVIDENDS TABLE my $GETDIVDATA= "INSERT INTO $DIVTABLE(SYMBOL, DATE, DIV, EXDIV, DIVDA +TE, DIVYIELD, EPS) VALUES (?,?,?,?,?,?,?)"; my $DIVDATA = $connect->prepare($GETDIVDATA)or die "NOT WORKING"; #GET THE FINANCIAL DATA my $q = Finance::Quote->new; # LOOP THROUGH RESULTS while($SYMBOLKEY->fetch()) { my %data; %data = $q->fetch('nyse', "$symbol"); my $S=$symbol; my $D=$data{$symbol,"date"}; my $DV=$data{$symbol,"div"}; my $EDV=$data{$symbol,"ex_div"}; my $DVD=$data{$symbol,"div_date"}; my $DVY=$data{$symbol,"div_yield"}; my $ES=$data{$symbol,"eps"}; $DIVDATA->execute($S,$D,$DV,$EDV,$DVD,$DVY,$ES) or die "NOT WORKING"; }

In reply to INSERT NOT EXECUTING by cparrett

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.