PDOStatement :: execute():SQLSTATE [HY093]:参数号无效:未定义参数

时间:2017-04-05 11:02:00

标签: pdo sql-update

下面的代码不起作用,给出上面提到的错误,指向写入数组$值的相应行。 帮我弄清楚出了什么问题。

$stmt = $this->dbc->prepare("UPDATE user SET first_name = :first_name, last_name = :last_name, user_screenshot = :user_screeenshot, mobile_number = :mobile_number, address = :address, zip_code = :zip_code, city_id = :city_id, state_id = :state_id, join_date = :join_date WHERE username = '$session'");

    $values = array(
                    ':first_name' => $first_name, ':last_name' => $last_name, ':user_screenshot' => $user_screenshot, ':mobile_number' => $mobile_number, ':address' => $address, ':zip_code' => $zip_code,
                    ':city_id' => $city_id, ':state_id' => $state_id, ':join_date' => $join_date
                );

    $stmt->execute($values);

0 个答案:

没有答案