에게 정의되지 않은 :SQLSTATE는 [HY093] : 잘못된 매개 변수 번호 : 매개 변수는 I이 기능이 OOP
private function sendVerification($username, $email)
{
global $pdo;
$this->check = $pdo->prepare("SELECT * FROM users where user_name = :username AND user_email = :email");
$this->check->execute(array(
":username" => $username,
":email" => $email
));
if ($this->check->rowCount())
{
$this->get = $this->check->fetch(PDO::FETCH_ASSOC);
$this->insert = $pdo->prepare
("
INSERT INTO account_verification
(user_id, generated_code, date, time)
VALUES
(:id, :code, CUTDATE(), CURTIME())
");
$this->insert->execute(array(
":id" => $this->get['user_id'],
"generated_code" => Users::generateCode($email)
));
}
else
{
throw new exception ("An error has occured!");
}
}
가 액세스를이 정적 :
public static function generateCode($salt)
{
return substr(hash('sha512', $salt), 0, 15);
}
먼저 내가 이름을 사용하고 있습니다 & 그걸로 행이 있다는 것을 확인하는 이메일 그럼 가져온 배열을 보유 할 var를 추가하려고합니다.
그리고 rowCount가 있는지 확인한 다음 데이터를 삽입합니다.
문제 :
나는이 오류
SQLSTATE[HY093]: Invalid parameter number: parameter was not defined
나는, 나는이 오류가 발생 적이 내가 이것을 받고있는 이유도 확실하지 않다
을 얻고, 내가 읽은 그것에 대해하지만 내 코드에서 문제가 될 것이라고 이해하지 못했습니다.
질문 :
꽤 많이, 왜 그 오류가 의미 하는가,이 원인을?
매개 변수는': code'이며,'execute()'배열에서와 같이': generated_code'가 아닙니다. –