CodeIgniter Forums
Stuck in fetching specific data - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5)
+--- Forum: General Help (https://forum.codeigniter.com/forumdisplay.php?fid=24)
+--- Thread: Stuck in fetching specific data (/showthread.php?tid=73011)



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();
        }