db_onedev = $this->load->database("onedev", true); $sql = "select * from m_emailconfig where M_EmailConfigIsActive = 'Y' limit 0,1"; $qry = $this->db_onedev->query($sql); if ($qry) { $rows = $qry->result_array(); if (count($rows) > 0 ) { echo json_encode($rows[0]); exit; } } echo json_encode( array()); } }