Codeigniter $this->db->get(), how do I return values for a specific row?

前端 未结 5 1400
佛祖请我去吃肉
佛祖请我去吃肉 2020-12-07 19:19

Say I have a database table with three columns: ID, Name, and Age. I need to find the user with a specific (unique) ID, and then return the age. Currently, I am using the fo

5条回答
  •  广开言路
    2020-12-07 19:58

    you can use row() instead of result().

    $this->db->where('id', '3');
    $q = $this->db->get('my_users_table')->row();
    

提交回复
热议问题