1 2 3 4 5 6 7 8 9 10
| $pdo = new PDO('mysql:host=localhost;dbname=philippe','root','');
$pdo->setAttribute(PDO::ATTR_ERRMODE,PDO::ERRMODE_WARNING);
$pdo->setAttribute(PDO::ATTR_DEFAULT_FETCH_MODE,PDO::FETCH_OBJ);
$sql = "SELECT * FROM membre WHERE email=:email and password=:password";
$stmt = $pdo->prepare($sql);
$stmt->bindParam('email', $this->email, PDO::PARAM_STR);
$stmt->bindParam('password', $this->password, PDO::PARAM_STR); //en général on évite de passer password en paramètre pour des raisons de sécurité
return $stmt; |
Partager