CodeIgniter Forums
Stuck in fetching specific data - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forum-5.html)
+--- Forum: General Help (https://forum.codeigniter.com/forum-24.html)
+--- Thread: Stuck in fetching specific data (/thread-73011.html)



Stuck in fetching specific data - Hairein - 03-10-2019

Hello to everyone! I'm creating my own app, where people can share own usernames. I have a problem here. Everthing is fine, but i'm unable to fetch data correctely.

What i want to do is:
  • grub from my database_name where people have a specific platform_name
So basically if people match Telegram, this query will output only those people. 

I'm using this to get usernames but now i need to filter them:

PHP Code:
        public function get_usernames($slug FALSE$limit FALSE$offset FALSE){
            if (
$limit) {
                
$this->db->limit($limit ,$offset);
            }
            if(
$slug === FALSE){
                
$this->db->order_by('usernames.id''DESC');
                
$query $this->db->get('usernames');
                return 
$query->result_array();
            }

            
$query $this->db->get_where('usernames', array('slug' => $slug));
            return 
$query->row_array();
        }