Advertisement
IcaroPeretti

UsuarioDAO

Dec 10th, 2020
1,123
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.86 KB | None | 0 0
  1. <?php
  2.     namespace App\dao;
  3.     use App\utils\ConnectionFactory;
  4.     use \PDO;
  5.  
  6.     class usuarioDAO{
  7.         public static function create($nome,$email,$password){
  8.             $con = ConnectionFactory::getConnection();
  9.             $stmt = $con->prepare("INSERT INTO usuarios (nome,email,senha) VALUES (:nome,:email,:senha)");
  10.             $stmt->bindParam(':nome',$nome,PDO::PARAM_STR);
  11.             $stmt->bindParam(':email',$email,PDO::PARAM_STR);
  12.             $stmt->bindParam(':senha',$hashed_password);
  13.             return $stmt->execute();
  14.         }
  15.  
  16.         public static function validation($email){
  17.             $con = ConnectionFactory::getConnection();
  18.             $stmt = $con->prepare("SELECT * FROM usuarios WHERE email = :email ");
  19.             $stmt->bindParam(':email', $email);
  20.             $stmt->execute();
  21.             return $stmt;
  22.         }
  23.  
  24. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement