daily pastebin goal
49%
SHARE
TWEET

Untitled

a guest Aug 20th, 2018 60 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. PHP mysql_num_rows() Returns error
  2. $username = mysql_real_escape_string($username);
  3. $query = "SELECT * FROM users WHERE username = '$username';";
  4. $result = mysql_query($query,$conn);
  5. if(mysql_num_rows($result)>0) //user exists
  6. {
  7.     header('Location: index.php');
  8.     $_SESSION['reg_error']='User already exists';
  9.     die();
  10. }
  11. else
  12. {
  13. $query = "INSERT INTO users ( username, password, salt )
  14.         VALUES ( '$username' , '$hash' , '$salt' );";
  15. mysql_query($query);
  16. mysql_close();
  17. header('Location: index.php');
  18.    
  19. mysql_num_rows(): supplied argument is not a valid MySQL result resource in [dirctory name]
  20.    
  21. $query = "SELECT * FROM users WHERE username = '$username';";
  22.    
  23. $query = "SELECT * FROM users WHERE username = '"
  24.     . mysql_real_escape_string($username)  . "';";
  25.    
  26. $username = mysql_real_escape_string($username);
  27.    
  28. $username = mysql_real_escape_string($_POST[$username]);
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top