SHARE
TWEET

Untitled

a guest Oct 4th, 2017 50 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. public static function find_by_id($uid=0){
  2.         // return an object populated based on user id
  3.         global $database;
  4.         $user = new User();
  5.        
  6.         $sql = "SELECT * FROM users ";
  7.         $sql .= "WHERE  id=${uid} ";
  8.         $sql .= "LIMIT 1";
  9.        
  10.         $result = $database->query($sql);
  11.    
  12.         if($database->num_rows($result)){
  13.             $row = $database->fetch_assoc($result);
  14.             $user->username = $row['username'];
  15.             $user->password = $row['password'];
  16.             $user->id = $uid;
  17.         }
  18.        
  19.         return $user;
  20.  
  21.     }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top