0

This is my code that works OK:

$stmt = $mysqli->prepare("INSERT INTO a (b1, b2, b3, b4) VALUES (?, ?, ?, ?) ON DUPLICATE KEY UPDATE b3 = b3 + 1;");
$arr = explode(',', $query); 
$stmt->bind_param("ssss",$arr[0],$arr[1],$arr[2],$arr[3]);
$stmt->execute();             
$stmt->close();

I need to update incrementally b3 (works fine, it is int value) and additionally insert a new value to b4 (it is varchar). This does not work:

$stmt = $mysqli->prepare("INSERT INTO a (b1, b2, b3, b4) VALUES (?, ?, ?, ?) ON DUPLICATE KEY UPDATE b3 = b3 + 1, b4 = VALUES(b4);");

My key is b1 and b2

Annabelle
  • 734
  • 9
  • 23

0 Answers0