title: 'Load More' sql function not loading correct products
body: <p>I am creating a CMS in CodeIgniter for a e-commerce site where the user can search for a product title, description or SKU and it will show the first 20 results. There is then a "more..." button which loads in the next 20 products. I can't, however, get the query for the "more..." to output the same amount of results. Here are my 2 functions from my model:</p>
  
  <pre><code>public function searchProducts($searchText)
  {
  
      $this-&gt;db-&gt;select("prod_id, prod_sku, prod_title, prod_desc, prod_main_image");
      $this-&gt;db-&gt;where("prod_sku LIKE '%{$searchText}%'");
      $this-&gt;db-&gt;or_where("prod_title LIKE '%{$searchText}%'");
      $this-&gt;db-&gt;or_where("prod_desc LIKE '%{$searchText}%'");
      $this-&gt;db-&gt;order_by("prod_id", "desc");
      $query = $this-&gt;db-&gt;get("products", 20);
  
      return $this-&gt;checkSalesProducts($query-&gt;result());
  
  }
  
  public function loadMoreSearchProducts($searchText, $id)
  {
  
      $this-&gt;db-&gt;select("prod_id, prod_sku, prod_title, prod_desc, prod_main_image");
      $this-&gt;db-&gt;where("(prod_sku LIKE '%{$searchText}%' OR prod_title LIKE '%{$searchText}%' OR prod_desc LIKE '%{$searchText}%') AND `prod_id` &lt; {$id}");
      $this-&gt;db-&gt;order_by("prod_id", "desc");
      $query = $this-&gt;db-&gt;get("products", 20);
  
      return $this-&gt;checkSalesProducts($query-&gt;result());
  
  }
  </code></pre>
  
  <p>In the load more function, the ajax call sends the ID of the last product displayed so that I can use a descending sort on the product ID to get products with lower IDs for the next 20.</p>
  
  <p>Any ideas?</p>