codeigniter让行无法正常工作

I've been doing a tutorial on CodeIgniter. Now I'm simply reading something from a database. I've checked the stuff I get from the db is legit. I then simply send the query result to a view called form. Now all I want to do in form is extract the stuff from the query. I get the following error:

Severity: Notice

Message: Undefined index: Name

Filename: views/form.php

Line Number: 36

Here is my controller code:

function index()
    {
        $data['reason'] = '';
        $this->load->model('CRUD_Model');
        $data['query']= $this->CRUD_Model->Read('tertiarystudy','Name is not NULL');
        $this->load->view('form',$data);
    }

Here is my view code:

foreach ($query as $row) 
    {
        echo $row['Name'];

    }

Does your model use db->result() or db->result_array() to get back the data? If it's result() then your rows are instances of stdClass. In that case, do:

foreach($query as $row) {
    echo $row->Name;
}

Please try this in your view..

foreach ($query as $row) 
    {
        echo $row[0]['Name'];

    }

Try with print_r result,

  foreach ($query as $row) {
      echo '<pre>';
      print_r($row);
      echo '</pre>'; 

      // if you get result a array, format array is $row['namefield'].
      // if you get result a object, format object is $row->namefield.
      // if you not get any result, you must check code in controller n model again.
  }

i think this sample code is useful

<?php
class Test extends CI_Controller{
    function __construct(){
        parent::__construct();
        $this->load->database();
    }

    public function index(){
        $this->db->select('userid');
        $some = $this->db->get('users_key',1)->result_array();
        var_dump($some);
    }

    // result_array Output
    // array(1) { [0]=> array(1) { ["userid"]=> string(1) "1" } } 

    // result Output
    // array(1) { [0]=> object(stdClass)#15 (1) { ["userid"]=> string(1) "1" } } 


}