php - Getting the values from array -
i new codeigniter. in model, have following code:
public function get_all_subjects() {    return $this->db->get('subjects'); } in controller, have:
public function index() {    $this->load->model('subjects');    $data['content'] = $this->subjects->get_all_subjects();     $this->load->view('home', $data); } i trying values in view:
foreach($content $val) {    echo $val['subject']; //i getting error, message: undefined index: subject } the fields in subjects table subject_id , subject.
i getting error message:
undefined index: subject
public function get_all_subjects()     {         return $this->db->get('subjects')->result_array();     } you not returning result query. have run query.
Comments
Post a Comment