Hi group!  Just got back from a trip, and I'm a little rusty (a rusty newbie, JOY)

Anyway, before I left I was having trouble inserting new data into my database table, 
and oddly enough, the problem didn't solve itself while I was gone. :(

Here is my current code.  I've been racking my brain, and consulting the various books 
I have on lend from the library, with no success.  It looks right to me!  Can someone 
please help me out?

I'm using Windows 98 with ActiveState Perl on Apache Web server.

use cgi;
use DBI;                                                                               
                    
$dbh = DBI->connect('dbi:ODBC:freq');  
DBI->trace( 2, 'errors.txt' );                                                         
           
$co = new CGI;                                                                         
                    
print $co->header, $co -> start_html(title=>'Canadian Online Radio Frequency 
Database'),                   
$co->center($co->h1('Thanks using our database!')), $co->h3('Here is what you 
submitted...'),$co->hr;#not done feedback yet           
print $co->hr;
print "Data Added<BR>\n";                                                              
                               
$newfreq=$co->param('txtFREQ');
$newloc=$co->param('txtLOC');
$newdesc=$co->param('txtDESC');
$newfreqtype=$co->param('txtFREQTYPE');
$newcat=$co->param('txtCAT');
$newcall=$co->param('txtCALL');
$newtx=$co->param('txtTX');
$sqlstatement = "INSERT INTO canfreqtable (freq, loc, desc, freqtype, cat, call, tx) 
VALUES (?,?,?,?,?,?,?)";
$sth = $dbh->prepare($sqlstatement) || die $dbh->errstr;
$sth->execute($newfreq, $newloc, $newdesc, $newfreqtype, $newcat, $newcall, $newtx) || 
die $dbh->errstr;
print "Thank you for submitting a frequency!";
print $co->end_html;



And here is what gets piped out to my errors.txt file.


      DBI 1.14-nothread dispatch trace level set to 2
    -> prepare for DBD::ODBC::db (DBI::db=HASH(0x1b38790)~0x1b3a194 'INSERT INTO 
canfreqtable (freq, loc, desc, freqtype, cat, call, tx) VALUES (?,?,?,?,?,?,?)')
    dbd_preparse scanned 7 distinct placeholders
    dbd_st_prepare'd sql f32113660
 INSERT INTO canfreqtable (freq, loc, desc, freqtype, cat, call, tx) VALUES 
(?,?,?,?,?,?,?)
    <- prepare= DBI::st=HASH(0x1b38880) at ADDTOF~1.PL line 29.
    -> execute for DBD::ODBC::st (DBI::st=HASH(0x1b38880)~0x1b05b08 '111111' 'MB' 
'TEST' 'VHF' 'FARM' 'TESTING' '22222')
bind 1 <== '111111' (attribs: )
bind 1 <== '111111' (size 6/7/0, ptype 4, otype 1)
    bind 1: CTy=1, STy=VARCHAR, CD=80, Sc=0, VM=6.
bind 2 <== 'MB' (attribs: )
bind 2 <== 'MB' (size 2/3/0, ptype 4, otype 1)
    bind 2: CTy=1, STy=VARCHAR, CD=80, Sc=0, VM=2.
bind 3 <== 'TEST' (attribs: )
bind 3 <== 'TEST' (size 4/5/0, ptype 4, otype 1)
    bind 3: CTy=1, STy=VARCHAR, CD=80, Sc=0, VM=4.
bind 4 <== 'VHF' (attribs: )
bind 4 <== 'VHF' (size 3/4/0, ptype 4, otype 1)
    bind 4: CTy=1, STy=VARCHAR, CD=80, Sc=0, VM=3.
bind 5 <== 'FARM' (attribs: )
bind 5 <== 'FARM' (size 4/5/0, ptype 4, otype 1)
    bind 5: CTy=1, STy=VARCHAR, CD=80, Sc=0, VM=4.
bind 6 <== 'TESTING' (attribs: )
bind 6 <== 'TESTING' (size 7/8/0, ptype 4, otype 1)
    bind 6: CTy=1, STy=VARCHAR, CD=80, Sc=0, VM=7.
bind 7 <== '22222' (attribs: )
bind 7 <== '22222' (size 5/6/0, ptype 4, otype 1)
    bind 7: CTy=1, STy=VARCHAR, CD=80, Sc=0, VM=5.
    dbd_st_execute (for sql f32113660 after)...
st_execute/SQLExecute error -1 recorded: [Microsoft][ODBC Microsoft Access Driver] 
Syntax error in INSERT INTO statement. (SQL-37000)(DBD: st_execute/SQLExecute err=-1)
    !! ERROR: -1 '[Microsoft][ODBC Microsoft Access Driver] Syntax error in INSERT 
INTO statement. (SQL-37000)(DBD: st_execute/SQLExecute err=-1)'
    <- execute= undef at ADDTOF~1.PL line 30.
    -> errstr in DBD::_::common for DBD::ODBC::db (DBI::db=HASH(0x1b38790)~0x1b3a194)
    <- errstr= ( '[Microsoft][ODBC Microsoft Access Driver] Syntax error in INSERT 
INTO statement. (SQL-37000)(DBD: st_execute/SQLExecute err=-1)' ) [1 items] at 
ADDTOF~1.PL line 30.
    -- DBI::END
    -> disconnect_all for DBD::ODBC::dr (DBI::dr=HASH(0x1b7dda8)~0x1b387e4)
    <- disconnect_all= '' at DBI.pm line 450.
    -> DESTROY for DBD::ODBC::st (DBI::st=HASH(0x1b05b08)~INNER)
    <- DESTROY= undef during global destruction.
    -> DESTROY for DBD::ODBC::db (DBI::db=HASH(0x1b3a194)~INNER)
    <- DESTROY= undef during global destruction.
    -> DESTROY in DBD::_::common for DBD::ODBC::dr (DBI::dr=HASH(0x1b387e4)~INNER)
    <- DESTROY= undef during global destruction.

Reply via email to