php - check $this->db->get() is empty or not -


i'm using codeigniter framework.

how can check get function empty or not?

... $result = $this->db->get()   //how check $result empty or not ? 

you can way

$query = $this->db->get(); if ($query->num_rows() > 0) {   //record exists - hence fetch row                 $result = $query->row();                }  else {   //record not exists } 

Comments

Popular posts from this blog

html - Outlook 2010 Anchor (url/address/link) -

javascript - Why does running this loop 9 times take 100x longer than running it 8 times? -

Getting gateway time-out Rails app with Nginx + Puma running on Digital Ocean -