in reply to Re^2: MySQL INSERT in Perl
in thread MySQL INSERT in Perl

"I've updated the code and $ins_rec prints nothing"

That's a big problem, right? So you now have two jobs:

First: find out why $ins_rec is empty when you try to send an INSERT to MySQL.

Second: Convert your program to use placeholders so that you are not subjecting yourself to possibly corrupt SQL or SQL injection attacks due to unescaped metacharacters.


Dave

Replies are listed 'Best First'.
Re^4: MySQL INSERT in Perl
by baperl (Sexton) on Aug 04, 2011 at 18:04 UTC
    hi Dave, I got it to work, and the $ins_rec is printing what it should. the insert is also working, and I checked the database to make sure it is all correct, and it is. however, I get this error message for the do():
    DBD::mysql::db do failed: Unknown column 'N' in 'field list' at otest. +pl line 52.
    I just posted the revised code in my new reply.

      I can't provide any additional help without knowing what $ins_rec looks like when you print it immediately prior to preparing your query.


      Dave

        hi Dave, here's what $ins_rec looks like with the print:
        my ins_rec is INSERT INTO options (symbol,valuation_dt,expn_dt,strike, +open,bid,ask,last,volume) VALUES('MCO130119C00055000',now(),'20130118 +',55.00,13,0.67,1.03,1.03,0);