CodeIgniter - return only one row?

后端 未结 10 1348
鱼传尺愫
鱼传尺愫 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:13

    class receipt_model extends CI_Model {

       public function index(){
    
          $this->db->select('*');
    
          $this->db->from('donor_details');
    
          $this->db->order_by('donor_id','desc');
    
          $query=$this->db->get();
    
          $row=$query->row();
    
          return $row;
     }
    

    }

提交回复
热议问题