title: I'm Trying to get property of non-object in my CI system.
body: <p>I'm Trying to get property of non-object in my CI system. </p>
  
  <p>Everything is working fine while navigating my records from user 1 to user 11 but when I navigated to the last user which is user 12 I'm getting this error notice..</p>
  
  <p>This is my Controller:</p>
  
  <pre><code>public function index()
      {
  
          $data['title']= 'Customer Card';
          $data['records'] = $this-&gt;customer_model-&gt;getAll();
          $data['taxcodes'] = $this-&gt;customer_model-&gt;getAllTaxCodes();
          $data['types'] = $this-&gt;customer_model-&gt;getAllCustomerTypes();
          $data['groups'] = $this-&gt;customer_model-&gt;getAllCustomerGroups();
          $data['groupcodes'] = $this-&gt;customer_model-&gt;getAllCustomerGroups();
  
          $shown_id = $this-&gt;uri-&gt;segment(3);
  
          if(!is_numeric($shown_id)){
              $shown_id = 0;
          } 
          if($shown_id == ""){
              $shown_id = 1;
          }
          $data['info'] = $this-&gt;customer_model-&gt;fetch_customers(1, $shown_id);
          $data['last_id'] = $this-&gt;customer_model-&gt;last_customer();
  
          $this-&gt;load-&gt;view('include/header', $data);
          $this-&gt;load-&gt;view('include/navbar', $data);
          $this-&gt;load-&gt;view('customer_view', $data);
          $this-&gt;load-&gt;view('include/sidebar', $data);
          $this-&gt;load-&gt;view('include/footer', $data);
  
      }
  </code></pre>
  
  <p>View:</p>
  
  <pre><code>    &lt;?php
  
              $customer_id = $info-&gt;customercode_id;
              $customer_code = $info-&gt;customercode;
              $customer_name = $info-&gt;customername;
              $customer_type = $info-&gt;typedescription;
              $customer_group = $info-&gt;customergroup;
              $customer_address = $info-&gt;customeraddress;
              $customer_addressalt = $info-&gt;customeraddressalt;
              $customer_grp_desc = $info-&gt;groupdescription;
              $customer_phone1 = $info-&gt;phone1;
              $customer_phone2 = $info-&gt;phone2;
              $customer_fax = $info-&gt;fax;
              $customer_email = $info-&gt;email;
              $customer_website = $info-&gt;website;
              $tax_code = $info-&gt;taxcode;
  
          ?&gt;
  </code></pre>
  
  <p>Model:</p>
  
  <pre><code>function getAllCustomerGroups()
          {
  
              $query = $this-&gt;db-&gt;query('SELECT customergroup, description FROM customergrouplist');
              return $query-&gt;result();
  
          }
  
          function getAllTransactionTypes()
          {
  
              $query = $this-&gt;db-&gt;query('SELECT description FROM transactioncodelist');
              return $query-&gt;result();
  
          }
  
          function getAllCustomerTypes()
          {
  
              $query = $this-&gt;db-&gt;query('SELECT customertypecode, customertypedescription FROM customertype');
              return $query-&gt;result();
  
          }
  
          function getAllTaxCodes()
          {
  
              $query = $this-&gt;db-&gt;query('SELECT tax_id, taxcode FROM tax');
              return $query-&gt;result();
  
          }
  
          function getAll() {
              $query = $this-&gt;db-&gt;query('SELECT customercode, customername, 
              customergroup, customertype, customeraddress, 
              website FROM customercard LIMIT 1');
              return $query-&gt;result();
          }
  
          function getLastID() {
              //$query = $this-&gt;db-&gt;query('SELECT max(customercode_id) FROM customercard');
              $query = $this-&gt;db-&gt;query('SELECT customercode_id FROM customercard ORDER BY customercode_id DESC LIMIT 1');
              return $query-&gt;row()-&gt;customercode_id;
          }
  
          public function fetch_customers($limit, $start) {
              $this-&gt;db-&gt;select('
              customercard.customercode_id, 
              customercard.customercode, 
              customercard.customername, 
              customercard.customergroup, 
              customertype.customertypedescription as typedescription, 
              customercard.customeraddress, 
              customercard.customeraddressalt, 
              tax.taxcode as taxcode,
              customercard.website, 
              customergrouplist.description as groupdescription, 
              customercard.phone1, 
              customercard.phone2, 
              customercard.fax, customercard.email');
              $this-&gt;db-&gt;limit($limit);
              $this-&gt;db-&gt;order_by('customercode_id');
              $this-&gt;db-&gt;join('customergrouplist','customercard.customergroup=customergrouplist.customergroup');
              $this-&gt;db-&gt;join('customertype','customercard.customertype=customertype.customertypecode');
  
              $this-&gt;db-&gt;join('tax','customercard.tax_id=tax.tax_id');
              $this-&gt;db-&gt;where('customercode_id', $start);
              $query = $this-&gt;db-&gt;get('customercard');
              //echo $this-&gt;db-&gt;last_query();
  
              //echo $query-&gt;num_rows();
              if ($query-&gt;num_rows() &gt; 0) {
                  $row = $query-&gt;row();
                  $data = $row;
                  return $data;
              } else {
                  return false;
              }
          }
  
          public function last_customer(){
              $this-&gt;db-&gt;select('customercode_id');
              $this-&gt;db-&gt;limit(1);
              $this-&gt;db-&gt;order_by('customercode_id','DESC');
              $query = $this-&gt;db-&gt;get('customercard');
              $row = $query -&gt; row();
              return $row-&gt;customercode_id;
          }
  </code></pre>
  
  <p>What seems to be the problem in my codings? Any idea? I would gladly appreciate your help. Thanks.</p>