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; }
In reply to Problem with insert using DBI by mnlight
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |