public function insertUser() { $this->password = hashPasswords($this->password, $this->username); $sql = "INSERT INTO users (firstname, lastname,username,password) \n\t\tVALUES('{$this->first_name}','{$this->last_name}','{$this->username}','{$this->password}')"; try { $this->db->exec($sql); echo "Registration Complete!"; } catch (Exception $e) { echo "Failed to register"; } }
public function __construct($password, $username, $db) { //echo "password: "******"<br>"; //echo "username: "******"<br>"; $this->username = cleanString($username); $password = cleanString($password); $this->password = hashPasswords($password, $this->username); //echo $this->password. "<br>"; $this->db = $db; $this->sqlSelect(); }