i got perl script which was working fine till recently .nothing was changed .This is back office script and the data it gets is from a trusted source.i didnt write it and i know very little about perl
I tried to debug the script to see where the erroe happens and this is what i got from dumper.foreach my $xmlfile (@productfiles) { my $XML = XML::Smart->new($xmlfile) or warn("Unable to parse $xmlfil +e: $!"), next; $XML = $XML->cut_root(); next if (!defined $XML->{Product}{Code} || $XML->{Product}{Code}->co +ntent != 1); my $prodid = $XML->{Product}{ID}; my @features = @{$XML->{Product}{ProductFeature}}; foreach my $feature (@features) { my $cat_featureid = $feature->{CategoryFeature_ID}; my $value = $feature->{Presentation_Value}; my $sql = "INSERT INTO products_features (product_id, feature_id, +value) VALUES (".$prodid.", ".$cat_featureid.", ".$dbh->quote($value) +.") ON DUPLICATE KEY UPDATE value=".$dbh->quote($value); $dbh->do($sql); print Dumper $sql; } undef $XML; $c_processed++; print "." if ($c_processed % 10 == 0); # indicate progress as operat +ions can take a long time } print "$c_processed product feature values imported or updated.\n";
$VAR1 = 'INSERT INTO products_features (product_id, feature_id, value) VALUES (9589372, 34200, \'Brother HL3040\') ON DUPLICATE KEY UPDATE value=\'Brother HL3040\'';
$VAR1 = 'INSERT INTO products_features (product_id, feature_id, value) VALUES (9589372, 41695, \'1\') ON DUPLICATE KEY UPDATE value=\'1\'';
DBD::mysql::db do failed: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ' '') ON DUPLICATE KEY UPDATE value=''' at line 2 at import_productfeatures.pl line 71.
I would appreciate if anyone can look at it..In reply to error ..ON DUPLICATE KEY UPDATE value=''' by nafri
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |