too long

i am using Codeigniter i am facing an issue while setting the values of "Limit" in a query,Limit is only showing "limit NULL"

Here is the snippet of my code.

SELECT block.loc, owner.name , block.dist_name FROM   house INNER JOIN block ON house.block_id = block.block_id INNER JOIN owner ON owner.house_id = house.house_id WHERE 
            block.dist = ? AND house.status = 5 limit ? , ? 
 $result = $this->db->query($qry, array($this->getDist(), (int) $this->getLimitStart(), (int) $this->getLimitOffset()));

dump for

(int) $this->getLimitStart() is '0' and (int) $this->getLimitOffset() is '10'

As I understand that you make your own getter setter of the object, the getter which u are providing in you query, is returning NULL is only because you are not using the same setter.

For Example: if You use it ($this->getLimitOffset()) you have to set it also like this yourObject->setLimitOffset(10). I think it will work for you now.

You should swap the start and offset values like this

SELECT block.loc, owner.name , block.dist_name FROM   house INNER JOIN block ON house.block_id = block.block_id INNER JOIN owner ON owner.house_id = house.house_id WHERE 
        block.dist = ? AND house.status = 5 limit ? , ? 
 $result = $this->db->query($qry, array($this->getDist(), (int) $this->getLimitOffset(),(int) $this->getLimitStart()));

Becsuse codeigniter active record limit's first parameter is limit abd second is offset.

http://codeigniter.com/user_guide/database/active_record.html

Try this: $this->db->limit($nrecords, $offset);