Php 警告:PDOStatement::execute():SQLSTATE[HY093]:无效参数编号:绑定变量的数量与令牌的数量不匹配
我是一名PHP初学者,目前正在开发我的PHP添加客户端用户帐户。我无法添加到数据库,因此收到此警告。警告:PDOStatement::execute():SQLSTATE[HY093]:无效参数编号:绑定变量的数量与令牌的数量不匹配我无法找到问题的特定解决方案。我们将非常感谢你的帮助。这是我的PHP代码Php 警告:PDOStatement::execute():SQLSTATE[HY093]:无效参数编号:绑定变量的数量与令牌的数量不匹配,php,mysql,Php,Mysql,我是一名PHP初学者,目前正在开发我的PHP添加客户端用户帐户。我无法添加到数据库,因此收到此警告。警告:PDOStatement::execute():SQLSTATE[HY093]:无效参数编号:绑定变量的数量与令牌的数量不匹配我无法找到问题的特定解决方案。我们将非常感谢你的帮助。这是我的PHP代码 <?php include 'config.php'; if ($_POST) { try { $clientunum = ""; $username = ($_POST
<?php
include 'config.php';
if ($_POST) {
try {
$clientunum = "";
$username = ($_POST['username']);
$userpass = ($_POST['userpass']);
$user_fname = ($_POST['user_fname']);
$user_lname = ($_POST['user_lname']);
$user_bdate = ($_POST['user_bdate']);
$companyname = ($_POST['companyname']);
$user_mobilenum = ($_POST['user_mobilenum']);
$rbStatus = ($_POST['rbStatus']);
// ******* FOR PHOTO START *********
$file = $_FILES['user_photopath'];
$filetmp = $_FILES["user_photopath"]["tmp_name"];
$filename = $_FILES["user_photopath"]["name"];
$filetype = $_FILES["user_photopath"]["type"];
$userphotopath = "usersimg/".$filename;
move_uploaded_file($filetmp, $userphotopath);
// ***** FOR PHOTO END ******
// ***** QUERY
$query = "INSERT INTO client SET CLIENT_UNUM=?, USERNAME=?, USERPASS=?,
USER_FNAME=?, USER_LNAME=?, USER_BDATE=?, USER_PHOTOPATH=?, COMPANY_NAME,
STATUS=?, USER_MOBILENUM=?";
$stmt = $conn->prepare($query);
$stmt -> bindParam(1,$clientunum);
$stmt -> bindParam(2,$username);
$stmt -> bindParam(3,$userpass);
$stmt -> bindParam(4,$user_fname);
$stmt -> bindParam(5,$user_lname);
$stmt -> bindParam(6,$user_bdate);
$stmt -> bindParam(7,$userphotopath);
$stmt -> bindParam(8,$companyname);
$stmt -> bindParam(9,$rbStatus);
$stmt -> bindParam(10,$user_mobilenum);
$stmt -> execute();
//header("location:addnewuseraccount.php");
// echo "<a href='records.php'>View Records</a>";
}
catch (Exception $e) {
echo "ERROR:".$e->getMessage();
}
}
else{
header("location:index.php");
}
?>
您忘记了
公司名称之后的参数,
$query = "INSERT INTO client SET CLIENT_UNUM=?, USERNAME=?, USERPASS=?,
USER_FNAME=?, USER_LNAME=?, USER_BDATE=?, USER_PHOTOPATH=?, COMPANY_NAME=?,
STATUS=?, USER_MOBILENUM=?";
你错过了这里
公司名称=?,