Bonjour

je fais mes débuts avec PDO. la requête me renvoie l'erreur suivante pour la ligne16:
Call to a member function fetch() on a non-object
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
<?php
session_start();
try {
	$connect = new PDO('mysql:host=webdocufmlinfo.mysql.db;dbname=webdocufmlinfo', 'webdocufmlinfo', 'Hndzc8rYaebT');
 
}
 
 catch (Exception $e) {
	die('Erreur : ' . $e->getMessage());
}
foreach ($_POST as $key => $val) {
	$$key = $connect->quote($val);
}
 
$reponse = $connect->query("SELECT * FROM  `utilisateurs-ident` WHERE mail='$name' OR nom='$name'");
$data = $reponse->fetch();
if ($pass == $data['mot-pass']) {
	$_SESSION['ident'] = $name;
 
} else {
	$_SESSION['ident'] = NULL;
}
$reponse->closeCursor();
?>
<script>document.location.href="index.php"</script>
</body>
</html>