Return to Snippet

Revision: 52465
at October 24, 2011 13:40 by yigidix


Initial Code
public function get_recent($limit = 0)
	{
		$query = $this->db->select('
			tw.id AS tw_id, 
                        t.name AS t_name, t.slug AS t_slug,
			tw.status AS tw_status, tw.created_date AS tw_created_date, 
			tw.created_by AS tw_created_by, tw.rate AS tw_rate,
			u.id_str AS u_id_str, u.name AS u_name, u.screen_name AS u_screen_name, 
			u.profile_image_url AS u_profile_image_url,
                        t.name AS t_name, t.slug AS t_slug
		')
		->from($this->table . ' AS tw')
		->join('users AS u', 'u.id_str = tw.created_by')
                ->join('tags AS t', 't.created_by = tw.created_by')
                ->order_by('tw.id', 'DESC');
		
		if ($limit) $query = $query->limit($limit);
		
		$query = $query->get();
		
		if ($query->num_rows() > 0)
			return $query->result();
		else
			return FALSE;
	}

Initial URL

                                

Initial Description

                                

Initial Title
Get Recent Tweets

Initial Tags
php, twitter

Initial Language
PHP