Bonjour a tous,
Voila j'ai une base de donnees de users et j'ai ecris un page login.php ki me redigera vers une autre page. Mon probleme est quans je saisie mon email et password, j'obtiens un warning:
voila mon code:Warning: mysqli_num_rows() expects parameter 1 to be mysqli_result, boolean given in D:\wamp\www\PHP-TESTS\includes\login_functions.inc.php on line 28
La ligne 28 est la suivante:
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
28
29
30
31
32
33
34
35
36
37
38
39 <?php function absolute_url($page='index1.php'){ $url='http://' .$_SERVER['HTTP_POST'] . dirname($_SERVER['PHP_SELF']); $url=rtrim($url, '/\\'); $url .= '/' . $page; return $url; } function check_login($dbc, $email='', $pass=''){ $errors=array(); if (empty($email)){ $errors[]='You forgot to enter your email address.'; } else { $e= mysqli_real_escape_string($dbc,trim ($email)); } if (empty ($pass)){ $errors[]= 'Your forgot to enter your password.'; } else { $p=mysqli_real_escape_string($dbc, trim ($pass)); } if (empty($errors)){ $q="SELECT user_id, first_name FROM users WHERE email='$e' AND password=SHA1('$p')"; $r=@mysqli_query($dbc, $q); if (mysqli_num_rows($r) == 1){ $row=mysqli_fetch_array($r, MYSQLI_ASSOC); return array(true, $row); } else { $errors[]='The email address and password entered do not match those on file.'; } } return array(false, $errors); } ?>
Selon vous qu'est ce qui s'est passe.if (mysqli_num_rows($r) == 1)
Merci
Billyrose







Répondre avec citation
Partager