请帮帮我!我遇到了错误
PDOStatement :: execute():SQLSTATE [HY093]:参数号无效:绑定变量数与
中的令牌数不匹配
我使用查询:
public function SaveStep1($data)
$id = intval($data['id']);
$query = $this->db->prepare("UPDATE `user_general_info` SET `soname` = :soname, `last_soname` = :last_soname, `name` = :name,
`middle_name` = :middle_name, `birthday` = :birthday, `birthplace` = :birthplace, `city_code` = :city_code,
`city` = :city, `street` = :street, `house` = : house, `corp` = :corp, `litera` = :litera, `flat` = :flat WHERE `id` = :id");
$query->bindParam(":soname", $data[0], PDO::PARAM_STR);
$query->bindParam(":last_soname", $data[1], PDO::PARAM_STR);
$query->bindParam(":name", $data[2], PDO::PARAM_STR);
$query->bindParam(":middle_name", $data[4], PDO::PARAM_STR);
$query->bindParam(":birthday", $data[5], PDO::PARAM_STR);
$query->bindParam(":birthplace", $data[6], PDO::PARAM_STR);
$query->bindParam(":city_code", $data[7], PDO::PARAM_STR);
$query->bindParam(":city", $data[8], PDO::PARAM_STR);
$query->bindParam(":street", $data[9], PDO::PARAM_STR);
$query->bindParam(":house", $data[10], PDO::PARAM_STR);
$query->bindParam(":corp", $data[11], PDO::PARAM_STR);
$query->bindParam(":litera", $data[12], PDO::PARAM_STR);
$query->bindParam(":flat", $data[13], PDO::PARAM_STR);
$query->bindParam(":id", $data['id'], PDO::PARAM_INT);
//print_r($data[0]);
return $query->execute();
答案 0 :(得分:2)
SQL语句中有拼写错误:
`house` = : house
应该是
`house` = :house