title: unable to get data though model function code igniter
body: <p>I have created one new function in a existing controller, in which I am accessing a model's function which has a query to get the list.</p>
  
  <p>I have loaded the model in controller. This model function works with other function but not working for new created function.</p>
  
  <pre><code>class Cart extends CI_Controller 
  {
      function Cart()
      {
          parent::__construct();
          $this-&gt;mdl_common-&gt;checkUserSession();
          $this-&gt;load-&gt;model('mdl_friend_web');
          $this-&gt;load-&gt;model('api/mdl_friend','mdl_friend_api');
          $this-&gt;load-&gt;model('mdl_cart_web');
          $this-&gt;load-&gt;library('pagination');
      }
  </code></pre>
  
  <p>//works for this function</p>
  
  <pre><code>    function ajax_get_cart_list($offset = 0) 
      {
          is_ajax();
          $this-&gt;load-&gt;model('mdl_cart_web');
  
          $limit = PER_PAGE;
  
          $s_data = $_POST;
  
          $carts = $this-&gt;mdl_cart_web-&gt;get_cart_list($limit,$offset,$s_data)-&gt;result_array();
          $totalRows = $this-&gt;mdl_cart_web-&gt;get_total_cart_product($s_data)-&gt;num_rows();
  
          $data = $this-&gt;mdl_common-&gt;pagination_data('cart/get_cart_list/',$totalRows,$limit,'show_data');
          $data['carts'] = $carts;
          $data['total_cart'] = $totalRows;
  
          $html = $this-&gt;load-&gt;view('cart/ajax_cart_list',$data,true);
          echo $html;
      }
  </code></pre>
  
  <p>//not working for this</p>
  
  <pre><code>    function calculate_distance()
      {
  
  
          $limit = '';
  
          $delivery = 0;
  
          $previousName = '';
          $count = 0;
          $oneShop = '0';
          is_ajax();
         // $this-&gt;load-&gt;model('mdl_cart_web');
          $lat1 = $_POST['lat1'];
          $long1 = $_POST['long1'];
        //  $user_id = $_POST['user_id'];
  
          $user_id = $this-&gt;session-&gt;userdata('user_id');
  
          $carts = $this-&gt;mdl_cart_web-&gt;get_cart_list($limit,0,'')-&gt;result_array();
  
          $response = array();
          $data['carts'] = $carts;
          foreach($data['carts'] as $row) {
  
              echo $row['store_latitude'];
  
          }
  
      }  
  </code></pre>
  
  <p>model</p>
  
  <pre><code>&lt;?php
  class Mdl_cart_web extends CI_Model
  {
  /*=================================================================================
                                  Get cart list   
  ==================================================================================*/
  
      function get_cart_list($limit,$offset,$data)
      {
          $this-&gt;db-&gt;select('c.*,p.*,s.name as store_name,s.latitude as store_latitude,s.longitude as store_longitude,count(r.product_id) as review , IFNULL(AVG(r.star),0) as avg_star,i.*',false);
          $this-&gt;db-&gt;join('p_product as p','c.product_id = p.product_id','left');
          $this-&gt;db-&gt;join('p_product_image as i','c.product_id = i.product_id','left');
          $this-&gt;db-&gt;join('p_product_review as r','c.product_id = r.product_id','left');
          $this-&gt;db-&gt;join('p_store as s','s.store_id = p.store_id','left');
          $this-&gt;db-&gt;limit($limit,$offset);       
          $this-&gt;db-&gt;where('c.user_id',$this-&gt;session-&gt;userdata('user_id'));
          $this-&gt;db-&gt;group_by('c.cart_id');
          $this-&gt;db-&gt;from('p_cart as c');
  
  
          return $this-&gt;db-&gt;get();
      }
  
  ?&gt;
  </code></pre>
  
  <p>I am not able to get the array data.I can see blank alert.
  What is going wrong here? Please help.Thank you.</p>