Since andyford has given the advice that is directly relevant, let me give you some slightly off-topic advice:

Here's a version of your code that applies some of those suggestions. It should be equivalent to what you posted (but I only tested to make sure that it compiles correctly).

#!/user/bin/perl -w use CGI qw(:standard); use CGI::Carp qw(fatalsToBrowser); use strict; use DBI; print "content-type: text/html\n\n"; my @parnames = qw/Update Name Region Region_Section POS NPC Requirements Requiredquests Fame Reward Rewardtype Title isrepeatable walkthrough date/; my @to_update = @parnames[2..$#parnames]; my @to_insert = @parnames[1..$#parnames]; my %col_name; my %par_value; for my $par ( @parnames ) { $col_name{$par} = lc( $par ); $par_value{$par} = param( $par ) || ''; } # handle some exceptional column names: $col_name{Region_Section} = 'region_region'; $col_name{Name} = 'quest_name'; $col_name{date} = 'updated'; my $sitepath = 'e:/web/public_html/finalfantasyinfo'; my $dbh = DBI -> connect ('dbi:ODBC:', '', '') or die "$DBI::errstr;"; if ($par_value{Update} eq 'on') { for my $par ( @to_update ) { next if ( $par_value{$par} eq 'No Update' ); my $sql = "update quests set $col_name{$par} = ? where quest_n +ame = ?"; my $sth = $dbh->prepare( $sql ); $sth->execute( $par_value{$par}, $par_value{Name} ) or die "$sql:\n $DBI::errstr"; } } else { my $cols = join( ",", @to_insert ); my $vals = join( ",", ("?") x scalar @to_insert ); my $sql = "insert into quests ($cols) values ($vals)"; my $sth = $dbh->prepare( $sql ); $sth->execute( @par_value{@to_insert} ) or die "$sql:\n $DBI::errstr"; } $dbh -> disconnect(); print "Looks like that worked.";

In reply to Re: Can not insert Date by graff
in thread Can not insert Date by Eagle_f90

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.