Guest User

Untitled

a guest
May 20th, 2018
145
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.59 KB | None | 0 0
  1.  
  2. <?php
  3. print "Login Page Check";
  4.  
  5. $db = new PDO('mysql:host=localhost;dbname=webgame;charset=UTF-8', 'user', 'pass');
  6. $db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
  7. $db->setAttribute(PDO::ATTR_EMULATE_PREPARES, false);
  8.  
  9. $stmt = $db->prepare("select * from userInfo where userName=? and password=?");
  10. $stmt->execute(array($_POST['username'], $_POST['password']));
  11. $rows = $stmt->fetchAll(PDO::FETCH_ASSOC);
  12. if ($rows)
  13. {
  14. echo "YES";
  15. echo $rows['userID']; //right here, it will print out 'Array', and I don't know why
  16. }
  17.  
  18.  
  19.  
  20.  
  21. print " " . $results;
  22.  
  23. ?>
Add Comment
Please, Sign In to add comment