@stasbombit

Почему выдает ошибку Invalid parameter number: number of bound variables does not match number of tokens?

Пишу обработку платежей
error_reporting(E_ALL);
ini_set('display_startup_errors', 1);
ini_set('display_errors', '1');


$label=$_POST["label"];
$amount=$_POST["amount"];
$notification_type=$_POST["notification_type"];
$operation_id=$_POST["operation_id"];
$withdraw_amount=$_POST["withdraw_amount"];
$currency=$_POST["currency"];
$datetime=$_POST["datetime"];
$sender=$_POST["sender"];


require_once 'main/boot.php';
$stmt = pdo()->prepare("INSERT INTO `ym_paying` (`notification_type`, `operation_id`, `amount`, `withdraw_amount`, `currency`, `datetime`, `sender`, `label`) VALUES (':notification_type', ':operation_id', ':amount;, ':withdraw_amount', ':currency', ':datetime', ':sender', ':label')");
$stmt->execute([
    'label' => $label,
    'amount' => $amount,
    'notification_type' => $notification_type,
    'operation_id' => $operation_id,
    'withdraw_amount' => $withdraw_amount,
    'currency' => $currency,
    'datetime' => $datetime,
    'sender' => $sender,
]);

но выдает ошибку:
Uncaught PDOException: SQLSTATE[HY093]: Invalid parameter number: number of bound variables does not match number of tokens in /home/z/z92616gy/z92616gy.beget.tech/public_html/ym_notification.php:27 Stack trace: #0 /home/z/z92616gy/z92616gy.beget.tech/public_html/ym_notification.php(27): PDOStatement->execute(Array) #1 {main} thrown in /home/z/z92616gy/z92616gy.beget.tech/public_html/ym_notification.php on line 27

Что делать?
  • Вопрос задан
  • 106 просмотров
Решения вопроса 1
alexey-m-ukolov
@alexey-m-ukolov Куратор тега PHP
-VALUES (':notification_type', ':operation_id
+VALUES (:notification_type, :operation_id
и т.д.
Ответ написан
Пригласить эксперта
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Войти через центр авторизации
Похожие вопросы