mercredi 2 décembre 2020

SQLSTATE[HY093 ]: Invalid parameter number: parameter was not defined

I am trying to do something like below in php using PDO:

$bonusIncomeReport = "INSERT INTO bonusincome (userId, amountType, amount) VALUES ((SELECT parentId FROM user WHERE userId = :userId), 'SB', :amount);";

        $stmt = $this->conn->prepare($query);

        $stmt->bindParam(":userId", $userId);
        $stmt->bindParam(":amount", $bonus);

        $stmt->execute();

It gives me following error:
SQLSTATE[HY093] : Invalid parameter number: parameter was not defined

I tried solving this error, but nothing happened. Even parameter that I am binding is exactly same as what I need.

Please Help!




Aucun commentaire:

Enregistrer un commentaire