Get Recent Tweets


/ Published in: PHP
Save to your folder(s)



Copy this code and paste it in your HTML
  1. public function get_recent($limit = 0)
  2. {
  3. $query = $this->db->select('
  4. tw.id AS tw_id,
  5. t.name AS t_name, t.slug AS t_slug,
  6. tw.status AS tw_status, tw.created_date AS tw_created_date,
  7. tw.created_by AS tw_created_by, tw.rate AS tw_rate,
  8. u.id_str AS u_id_str, u.name AS u_name, u.screen_name AS u_screen_name,
  9. u.profile_image_url AS u_profile_image_url,
  10. t.name AS t_name, t.slug AS t_slug
  11. ')
  12. ->from($this->table . ' AS tw')
  13. ->join('users AS u', 'u.id_str = tw.created_by')
  14. ->join('tags AS t', 't.created_by = tw.created_by')
  15. ->order_by('tw.id', 'DESC');
  16.  
  17. if ($limit) $query = $query->limit($limit);
  18.  
  19. $query = $query->get();
  20.  
  21. if ($query->num_rows() > 0)
  22. return $query->result();
  23. else
  24. return FALSE;
  25. }

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.