Advertisement
Guest User

Untitled

a guest
Jan 20th, 2017
162
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.19 KB | None | 0 0
  1. <?php
  2.  
  3. protected $Conecta;
  4. private $host = "localhost";
  5. private $dbname = "classificados";
  6. private $user = "root";
  7. private $pass = "";
  8.  
  9. public function __construct() {
  10.  
  11. try {
  12.  
  13. $this->Conecta = new PDO("mysql:host={$this->host};dbname={$this->dbname}", "{$this->user}", "{$this->pass}");
  14. return $this->Conecta;
  15. } catch (PDOException $e) {
  16.  
  17. echo $e->getMessage();
  18. }
  19. }
  20.  
  21. <?php
  22.  
  23. private $verificaUser;
  24.  
  25. public function setUsuario($email, $senha) {
  26. $this->verificaUser = parent::prepare("SELECT email, senha FROM usuarios WHERE cl_email = :email AND senha = :senha");
  27. $this->verificaUser->bindValue(":email", $email);
  28. $this->verificaUser->bindValue(":senha", $senha);
  29. $this->verificaUser->execute();
  30. return $this->verificaUser->rowCount();
  31. }
  32.  
  33. public function getUsuario() {
  34. return $this->setUsuario();
  35. }
  36.  
  37. Fatal error: Uncaught Error: Call to undefined method Conexao::prepare() in /opt/lampp/htdocs/classificados/model/Sessao.class.php:10 Stack trace: #0 /opt/lampp/htdocs/classificados/model/Sessao.class.php(24): Sessao->setUsuario('fulano@bol.com', '123') #1 {main} thrown in /opt/lampp/htdocs/classificados/model/Sessao.class.php on line 10
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement