title: I cant pass variable from controller to view in Codeigniter
body: <p>I get error saying:</p>
  
  <blockquote>
    <p>A PHP Error was encountered</p>
    
    <p>Severity: Notice</p>
    
    <p>Message: Undefined variable: data</p>
    
    <p>Filename: views/businessinfo_view.php</p>
  </blockquote>
  
  <p>My model:</p>
  
  <pre><code>function getPosts(){
     $query = $this-&gt;db-&gt;query("SELECT * FROM customer WHERE 
     customer_id=12;");           
     return $query-&gt;result_array();
  }
  </code></pre>
  
  <p>My controller:</p>
  
  <pre><code> function ind() {
     $data['customerinfo'] = $this-&gt;user_model-&gt;getPosts(); 
     $this-&gt;load-&gt;view('businesssinfo_view', $data); 
   }
  </code></pre>
  
  <p>MY view:</p>
  
  <pre><code>&lt;?php foreach($data as $d){?&gt;
   &lt;tr&gt;
       &lt;td&gt;&lt;?php echo $d-&gt;customer_id;?&gt;&lt;/td&gt;
       &lt;td&gt;&lt;?php echo $d-&gt;first_name);?&gt;&lt;/td&gt;
    &lt;/tr&gt;     
  &lt;?php }?&gt;  
  </code></pre>
  
  <p>I tried 100 different ways, still can pass the variables, I know my query is correct, I can fetch and echo data in controller, I can't just pass it into view. someone please help me!</p>