Я просто пробовал этот код:
public function create_account($username, $password, $email) {
$password = sha1($password);
$activation_key = md5($username . $email);
$this->STH = $this->DBH->prepare("INSERT INTO users(username, password, email, activation_key, created) VALUES(:username, :password, :email, :activation_key, :created)");
$this->STH->bindParam(':username', $username);
$this->STH->bindParam(':password', $password);
$this->STH->bindParam(':email', $email);
$this->STH->bindParam(':activation_key', $activation_key);
$this->STH->bindParam(':created', time());
$this->STH->execute();
if ($this->DBH->lastInsertId()) {
//$this->send_mail($username, $email);
return true;
} else {
//Log
}
}
Теперь это работает, действительно. Но всего минуту назад я пропустил а) оператора SQL, что привело к тому, что данные не были вставлены. Я попытался с блоком try {} catch - Но я все равно не получил никакой ошибки - Это так?
Как я могу исправить этот код, чтобы правильно регистрировать ошибку PDO (если получено)