in reply to Re^2: error ..ON DUPLICATE KEY UPDATE value='''
in thread error ..ON DUPLICATE KEY UPDATE value='''

RaiseError => 1 is set. the error i get now is this..
$VAR1 = 'INSERT INTO products_features (product_id, feature_id, value) VALUES (5652151, , \'\') ON DUPLICATE KEY UPDATE value=\'\'';
looks like the feature_id, value is empty here..What can i do to fix this..

Replies are listed 'Best First'.
Re^4: error ..ON DUPLICATE KEY UPDATE value='''
by runrig (Abbot) on Aug 02, 2013 at 23:18 UTC
    What values should be inserted? If a blank feature_id is valid, supply a NULL (no quotes). If it is not valid, then skip that record.
      thanks all of you.. i finally sorted it out.. i changed the function to this and it works
      if($prodid && $cat_featureid && $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); }