私は自分のアプリケーション用の非常にシンプルなカウンターに取り組んでいます。「$date」と「$c」を使用して行を挿入することはできますが、更新は機能しません。
これは機能します:
$c = 8;
$today = date('Y-m-d');
$insert_count = $db->prepare("INSERT INTO COUNTER (COUNTER.date, clicks) VALUES ('" . $today . "', ?)");
$insert_count->execute(array($c));
これはしません
$c = 8;
$today = date('Y-m-d');
$update_count = $db->prepare("UPDATE COUNTER SET clicks = clicks + ? WHERE COUNTER.date = '" . $today . "'");
$update_count->execute(array($c));
エラーはありません。