Browse Source

add getUserList

visuddhinanda 3 years ago
parent
commit
295d34b1d8
1 changed files with 13 additions and 0 deletions
  1. 13 0
      public/app/ucenter/function.php

+ 13 - 0
public/app/ucenter/function.php

@@ -110,6 +110,19 @@ class UserInfo
             return false;
             return false;
         }
         }
 	}
 	}
+    public function getUserList($key){
+        if ($this->dbh) {
+            $query = "SELECT id,userid,nickname,username FROM user WHERE  username like ? ";
+            $stmt = $this->dbh->prepare($query);
+            $stmt->execute(array($key."%"));
+            $user = $stmt->fetchAll(PDO::FETCH_ASSOC);
+            if ($user) {
+                return $user;
+            }
+        } else {
+            return false;
+        }
+    }
 	public function check_password($userid,$password){
 	public function check_password($userid,$password){
 		if ($this->dbh) {
 		if ($this->dbh) {
             $query = "SELECT username FROM user WHERE  userid= ? and password = ? ";
             $query = "SELECT username FROM user WHERE  userid= ? and password = ? ";