当我提交表格时,它不断给我错误

时间:2017-06-29 11:56:08

标签: php mysql pdo

获取错误: -

  

SQLSTATE [HY093]:参数号无效:绑定变量数   与令牌数量不匹配。

$stmt = $db_con->prepare("INSERT INTO 
tbl_customer(First_name,Last_name,Email, Mobile_number, 
Landline_number, Address_1, Address_2, City, Password, Joining_date) 
VALUES(:firstname,:lastname, :email, :mbl_nmbr, landline_nmbr, 
reg_add1, reg_add2, reg_cus_city, :pass ,jdate)");

$stmt->bindParam(":firstname",$reg_user_first_name);
$stmt->bindParam(":lastname",$reg_user_last_name);
$stmt->bindParam(":email",$reg_user_email);
$stmt->bindParam(":mbl_nmbr",$mobile_number);
$stmt->bindParam(":landline_nmbr",$landline_nmbr);
$stmt->bindParam(":reg_add1",$reg_add1);
$stmt->bindParam(":reg_add2",$reg_add2);
$stmt->bindParam(":reg_cus_city",$reg_cus_city);
$stmt->bindParam(":pass",$password);
$stmt->bindParam(":jdate",$joining_date);

1 个答案:

答案 0 :(得分:1)

在上面的查询中,您错过了在bindParam上添加":#34;

使用此

$stmt = $db_con->prepare("INSERT INTO 
tbl_customer(First_name,Last_name,Email, Mobile_number, 
Landline_number, Address_1, Address_2, City, Password, Joining_date) 
VALUES(:firstname,:lastname, :email, :mbl_nmbr, :landline_nmbr, 
:reg_add1, :reg_add2, :reg_cus_city, :pass ,:jdate)");

我觉得它对你有用。