Changeset 19973

Show
Ignore:
Timestamp:
09/26/08 21:30:55 (5 years ago)
Author:
kenji
Message:

Add methods

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • events/phpframework/codeigniter/trunk/system/application/models/user_model.php

    r19449 r19973  
    1414                $row = $query->row(); 
    1515                return array($row->username, $row->image); 
     16        } 
     17 
     18        function get_username_and_image_by_username($username) 
     19        { 
     20                $this->db->select('id, username, image'); 
     21                $query = $this->db->get_where('users', array('username' => $username)); 
     22                return $query->row(); 
    1623        } 
    1724 
     
    5360        } 
    5461 
     62        function get_friends_count($id) 
     63        { 
     64                $this->db->select('COUNT(*) AS count'); 
     65                $this->db->where('user_id', $id); 
     66                $query = $this->db->get('followers'); 
     67                $row = $query->row(); 
     68                return $row->count; 
     69        } 
     70 
     71        function get_followers_count($id) 
     72        { 
     73                $this->db->select('COUNT(*) AS count'); 
     74                $this->db->where('follow_id', $id); 
     75                $query = $this->db->get('followers'); 
     76                $row = $query->row(); 
     77                return $row->count; 
     78        } 
     79 
    5580}