Advertisement
Guest User

Untitled

a guest
Apr 16th, 2014
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.71 KB | None | 0 0
  1. Users table structure is this: id|username|password|email
  2.  
  3. id - auto_increment + primary_key
  4. username - unique index
  5. email - unique index
  6.  
  7. $post_input = $_POST['user_input'] //will be username or email
  8.  
  9. $check = $db->prepare("Select * from users where username=? or email=?")
  10. $check->execute(array($post_input,$post_input));
  11. if($check->rowCount() > 0){
  12. //Username or Email found from here do the rest of the things
  13. }
  14.  
  15. $post_input = $_POST['user_input'] //will be username
  16.  
  17. $check = $db->prepare("Select * from users where username=?")
  18. $check->execute(array($post_input));
  19. if($check->rowCount() > 0){
  20. //Username found from here do the rest of the things
  21. }
  22.  
  23. Select * from users where username=? limit 0,1
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement