PHP トラブル

エラーが出たコード

$sql_main = “UPDATE entries1 SET status1 = ‘g’, comment2 = ‘?’, time2 = cast(now() as datetime), ip_ad = ‘?’ WHERE n1 = ? and entry_id = ‘?'”;

$result_main = $dbh->prepare($sql_main);
$result_main->bindParam(1,$comme2);
$result_main->bindParam(2,$ipad1);
$result_main->bindParam(3,$nn);
$result_main->bindParam(4,$search_key);

エラー内容
「?の数が合わない」みたいなエラー文

解決したコード

$sql_main = “UPDATE entries1 SET status1 = ‘g’, comment2 = ?, time2 = cast(now() as datetime), ip_ad = ? WHERE n1 = ? and entry_id = ?”;

$result_main = $dbh->prepare($sql_main);
$result_main->bindParam(1,$comme2);
$result_main->bindParam(2,$ipad1);
$result_main->bindParam(3,$nn);

コメント

タイトルとURLをコピーしました