简体   繁体   中英

MariaDB Invalid parameter number: parameter was not defined

I've been looking and looking at this code, but I can't find the problem. Can you help me to see it?

    $query = $dbc->prepare('UPDATE `division`
                            SET    `delete_flag` = 1,
                                   `updated_by`  = :user_id, 
                                   `updated_ip`  = :used_ip
                            WHERE  `division_id` = :division_id');
    $query->bindValue(':user_id',
                      $_SESSION['logged_in_person_id'],
                      PDO::PARAM_INT);
    $query->bindValue(':user_ip', $_SERVER['REMOTE_ADDR'], PDO::PARAM_STR);
    $query->bindValue(':division_id', $division_id, PDO::PARAM_INT);
    $query->execute();

Why is the query execute giving me "HY093 SQLSTATE[HY093]: Invalid parameter number: parameter was not defined"?

我看你有没有updated_ip =:used_ip,然后在$query->bindValue你使用:user_ip”?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM