title: A PHP Error was encountered Severity: Notice Message: Undefined property: Social::$social_model Filename: controllers/social.php Line Number: 10
body: <p>while running the codeigniter I have a following error:</p>
  
  <blockquote>
    <p>A PHP Error was encountered Severity: Notice Message: Undefined property: Social::$social_model Filename: controllers/social.php Line Number: 10</p>
  </blockquote>
  
  <p>Whats wrong with my code any help please?</p>
  
  <p><code>controllers/social.php</code></p>
  
  <pre><code>class Social extends CI_Controller {
  
      public function index(){
  
              $data = array();
              $this-&gt;load-&gt;view('header.php');
              $this-&gt;load-&gt;view('staffs/content.php');
              if ($query = $this-&gt; social_model -&gt; get_records()) // **[line 10]**
              {
                  $data['records'] = $query;
              }
  
              $this-&gt;load-&gt;view('social/content.php', $data); 
              $this-&gt;load-&gt;view('footer.php');
          }
  
     // ....
  }
  </code></pre>
  
  <p><code>models/social_model.php</code></p>
  
  <pre><code>&lt;?php
  class  social_model extends CI_Model{
  
      function get_records()
      {
          $query = $this-&gt;db-&gt;get('admins');
          return $query -&gt; result();
      }
  
     // ....
  }
  </code></pre>