Guest User

Untitled

a guest
Aug 10th, 2018
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.96 KB | None | 0 0
  1. Warning: mysql_fetch_assoc() expects parameter 1 to be resource, object given
  2. $username = $_POST['username'];
  3. $password = $_POST['password'];
  4.  
  5. if($username&&$password)
  6. {
  7. require 'conn.php';
  8. $query = "SELECT * FROM users WHERE username='$username'";
  9. $result = $mysql->query($query) or die(mysqli_error($mysql));
  10. $numrows = $result->num_rows;
  11.  
  12. if ($numrows!=0)
  13. {
  14. while($row = mysql_fetch_assoc($result))
  15. {
  16. $dbusername = $row['username'];
  17. $dbpassword = $row['password'];
  18. }
  19.  
  20. //check to see if they match!
  21. if($username==$dbusername&&$password==$dbpassword)
  22. {
  23. echo "youre In!";
  24. }
  25. else
  26. echo "incorrect password!";
  27.  
  28. }
  29. else
  30. die("that user is dead");
  31.  
  32. //echo $numrows;
  33.  
  34. }
  35.  
  36. else
  37.  
  38. echo ("Please Enter Username")
  39.  
  40. while($row = mysql_fetch_assoc($result))
  41.  
  42. while($row = $result->fetch_assoc())
  43.  
  44. $row = $result->fetch_assoc();
Add Comment
Please, Sign In to add comment