Advertisement
Guest User

Untitled

a guest
Jun 21st, 2015
540
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.38 KB | None | 0 0
  1. ID | emailaddress | password
  2. 1 | dummy@email.com | DUMB1PASS
  3. 2 | second@email.com | DUMB2Pass
  4.  
  5. $email = "dummy@email.com";
  6. $servername = "correct"; $username = "correct"; $DBpass = "correct"; $dbname = "correct";
  7. $conn = new mysqli($servername, $username, $DBpass, $dbname);
  8. if ($conn->connect_error)
  9. {
  10. die("Connection failed: " . $conn->connect_error);
  11. }
  12.  
  13. $sql = "SELECT emailaddress FROM registration WHERE emailaddress = '$email'";
  14. $result = $conn->query($sql);
  15.  
  16. if ($result->num_rows > 0)
  17. {
  18. echo "we found a match";
  19. }
  20. else
  21. {
  22. echo "we did not find a match";
  23. }
  24.  
  25. $email = "dummy@email.com";
  26. $servername = "correct"; $username = "correct"; $DBpass = "correct"; $dbname = "correct";
  27. $conn = new mysqli($servername, $username, $DBpass, $dbname);
  28. if ($conn->connect_error)
  29. {
  30. die("Connection failed: " . $conn->connect_error);
  31. }
  32.  
  33. $sql = "SELECT password FROM registration WHERE emailaddress = '$email'";
  34. $result = $conn->query($sql);
  35.  
  36. if ($result->num_rows > 0)
  37. {
  38. echo "the value is '$result'";
  39. }
  40. else
  41. {
  42. echo "we did not find a match";
  43. }
  44.  
  45. Catchable fatal error: Object of class mysqli_result could not be converted to string in MYPAGE on line XX.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement