Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 5844503
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T12:18:05+00:00 2026-05-22T12:18:05+00:00

I have a LoteModel: public function selecionar($where = NULL, $limit = NULL, $order_by =

  • 0

I have a LoteModel:

public function selecionar($where = NULL, $limit = NULL, $order_by = NULL) {
            if(!is_null($where)) {
                $this->db->where($where);
            }
            if(!is_null($limit)) {
                $this->db->limit($limit);
            }
            if(!is_null($order_by)) {
                $this->db->order_by($order_by);
            }

            return $this->db->get(_LOTE_);//_LOTE_ is a constant for my table name
    }

and I call it like this:

$config['per_page'] = '5';

$limite = $config['per_page'].','.$this->uri->segment(3); //the segment is ok, I receive it

$lotes = $this->LoteModel->selecionar(array('quadra_id'=>$quadra_id, 'lote_status'=>1), $limite, 'lote_endereco'); 

I have checked the SQL result for that query:

SELECT * FROM (`realestate_lote`) WHERE `quadra_id` = '1' AND `lote_status` = 1 ORDER BY `lote_endereco` 

The thing is, it’s not generating my LIMIT, it will only work if I add it to the LoteModel method.

I’m working with pagination.

Thanks in advance for any help =)

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T12:18:06+00:00Added an answer on May 22, 2026 at 12:18 pm

    You can’t pass a string like “5,1” to CI’s ActiveRecord limit function.
    The function requires two parameters.

    Split the limit string by “,” and pass the two values like the example below.

    $limit = explode(',', $limit);
    $this->db->limit($limit[0], $limit[1]);
    

    Hope this helps…

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Have you managed to get Aptana Studio debugging to work? I tried following this,
have such zend query: $select = $this->_table ->select() ->where('title LIKE ?', '%'.$searchWord.'%') ->where('description LIKE
Have a look at the menus on this page: http://www.pieterdedecker.be/labs/vspwpg/?page_id=96 They look okay in
have a table that dynamically generates text boxes in run time. I want to
I have a script that appends some rows to a table. One of the
I have found this example on StackOverflow: var people = new List<Person> { new
Have same challenge as this guy: How to copy dependencies to gae war/WEB-INF/lib Applying
have a wierd issue. for the life of me can't trace this back (its
Have a slight problem. Trying to post XML to a server. To do this,
have tried a few different approaches to this but with no success so far.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.