Advertisement
Guest User

numRowsGreatherThanOne2

a guest
Nov 23rd, 2018
116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.54 KB | None | 0 0
  1. function numRowsGreatherThanOne($sql, $parameters) {
  2.  
  3.     $conn = getConnection(); //Function I made that returns a connection
  4.  
  5.     $stmt = $conn->prepare($sql);
  6.     call_user_func_array([$stmt, "bind_param"], $parameters);
  7.     $stmt->execute();
  8.     $stmt->store_result();
  9.  
  10.     if ($stmt->num_rows > 1) {
  11.         return true;
  12.     }
  13.  
  14.     else {
  15.         return false;
  16.     }
  17.  
  18. }
  19.  
  20. $username = "User123";
  21. $password = "Secret";
  22.  
  23. numRowsGreatherThanOne("SELECT * FROM users WHERE username=? AND password=?", ["ss", $username, $password]);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement