我是编码新手。目前正在尝试设置注册表单。我搜索了答案,因为我看到在 execute() 之前绑定参数可能会起作用。但是,我不知道该怎么做。请帮忙。下面的代码显示以下错误:
致命错误:未捕获错误:调用 C:\xampp\htdocs\kibble\php-user-registration-form\DataSource.php:99 中布尔值的成员函数 execute() 堆栈跟踪:#0 C:\xampp\htdocs \kibble\php-user-registration-form\Member.php(83): Phppot\DataSource->insert('INSERT INTO reg...', 'ssss', Array) #1 C:\xampp\htdocs\kibble \php-user-registration-form\index.php(20): Phppot\Member->insertMemberRecord('lalafasdf123', 'Moka24', '123123123123', 'localoca@gmail....') #2 {main}扔在 C:\xampp\htdocs\kibble\php-user-registration-form\DataSource.php 第 99 行
public function insert($query, $paramType, $paramArray)
{
print $query;
$stmt = $this->conn->prepare($query);
$this->bindQueryParams($stmt, $paramType, $paramArray);
$stmt->execute();
$insertId = $stmt->insert_id;
return $insertId;
}
如果需要插入函数
function insertMemberRecord($username, $displayName, $password, $email)
{
$passwordHash = md5($password);
$query = "INSERT INTO registered_users (user_name, display_name, password, email) VALUES (?, ?, ?, ?)";
$paramType = "ssss";
$paramArray = array(
$username,
$displayName,
$passwordHash,
);
$insertId = $this->ds->insert($query, $paramType, $paramArray);
return $insertId;
}
子衿沉夜