Advertisement
joris

PDO Driver

Oct 6th, 2012
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.44 KB | None | 0 0
  1. function login($user,$pass) {
  2.     $sql = "SELECT username,password FROM user WHERE username=:user and password=:pass";
  3.     try {
  4.         $db = getConnection();
  5.         $stmt = $db->prepare($sql);  
  6.         $stmt->bindParam("username", $user);
  7.         $stmt->bindParam("password", $pass);
  8.         $stmt->execute(array(':username' => $user, ':password' => $pass));
  9.         $db = null;
  10.         echo '{"Report":{"Sukses"}}';
  11.     } catch(PDOException $e) {
  12.         echo '{"Report":{"Gagal"}}';
  13.     }
  14. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement