CodeIgniter - return only one row?

后端 未结 10 1362
鱼传尺愫
鱼传尺愫 2020-12-01 02:43

At the moment if I am doing a query on the database that should only return one row, using:

...query stuff...
$query = $this->db->get();
$ret = $query-         


        
10条回答
  •  孤城傲影
    2020-12-01 03:18

    You've just answered your own question :) You can do something like this:

    $query = $this->db->get();
    $ret = $query->row();
    return $ret->campaign_id;
    

    You can read more about it here: http://www.codeigniter.com/user_guide/database/results.html

提交回复
热议问题