mnlight has asked for the wisdom of the Perl Monks concerning the following question:
if ($param{submit} && $param{day} >0 && $param{day} <= $leapdays{$tmp +mon}&& $param{month} > 0 && $param{month} <= 12 && $param{year } > 1920 ) { $id++; #$mysql->Insert("events",$id,$param{day},$param{month},$param{ +year},$param{subject},$param{description},$username); $mysql->Insert("events",$param{day},$param{month},$param{year} +,$param{subject},$param{description},NULL); print "Record Inserterd";
sub Insert { my $self = shift; my $table = shift; my @fields; my @values; my $show_field; foreach (@_) { my ($field_name,$value) = split(/\|/,$_); if (!$value) { $show_field = 1; $_ = &clean_text($_); push (@values,$_); } else { $value = &clean_text($value); push(@fields,$field_name); push(@values,$value); } } my $value = join("\',\'",@values); $value = "\'$value\'"; if ($show_field != 1) { my $field = join(",",@fields); $field = "($field)"; } my $mysql = "INSERT INTO $table $field VALUES ($value)"; #return $mysql; my $sth = $self->_execute($mysql); #my $sth = $self->[0]->prepare($mysql) or die "Prep Error"; #my $rv = $sth->execute or die "Exec Error"; #return $self; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: It won't insert
by Juerd (Abbot) on Mar 20, 2002 at 07:28 UTC | |
|
Re: It won't insert
by dws (Chancellor) on Mar 20, 2002 at 07:45 UTC | |
by dragonchild (Archbishop) on Mar 20, 2002 at 14:44 UTC | |
by dws (Chancellor) on Mar 20, 2002 at 18:10 UTC | |
by dragonchild (Archbishop) on Mar 20, 2002 at 18:34 UTC | |
|
Re: It won't insert
by seattlejohn (Deacon) on Mar 20, 2002 at 07:54 UTC | |
by rdfield (Priest) on Mar 20, 2002 at 10:25 UTC | |
by VSarkiss (Monsignor) on Mar 20, 2002 at 17:04 UTC |