A PHP Error was encountered Severity: Notice
Message: Undefined variable: result
Filename: user/messages.php
Line Number: 87
Backtrace:
File: E:\xampp\htdocs\ci\application\views\user\messages.php Line: 87 Function: _error_handler
File: E:\xampp\htdocs\ci\application\controllers\users\Dashboard.php Line: 12 Function: view
File: E:\xampp\htdocs\ci\index.php Line: 315 Function: require_once
here is my code Controller
      <?php defined('BASEPATH') OR exit('No direct script access allowed');
        class Bills extends CI_Controller{
       function __construct(){
      parent::__construct();
     }
     public function bill(){
     $id = $this->session->userdata('email');
     $this->load->database();
     $this->load->helper(array('form', 'url', 'html'));
     $this->load->model('fuser/Bill');
     $data['result'] = $this->Bill->bills();
     $this->load->view('user/messages',$data);
      }
      }
      ?>
**Model**
      <?php  
     class Bill extends CI_Model  
     {  
      function __construct()  
      {  
         // Call the Model constructor  
         parent::__construct();  
      }  
      //we will use the select function  
      public function bills($id)  
      {  
         //data is retrive from this query  
     $query = $this->db->get('invoices'); 
       return $query->result();   
      }  
      }  
     ?> 
**View**
      <div class="billing_tabs_text_part">
                <?php foreach($result as $row){?>
                  <p><?php echo $row['book_id']; }?></p>
                </div>
 
     
     
     
     
    