I have two variables, $take (limit) and $skip (offset) which are the values for a limit clause in mysql.
Now Code Igniter does it’s limit clauses backwards.
E.g.
$this->db->limit(5,10) would product LIMIT 10, 5 in MYSQL.
Anyway, I am having a hard time getting my head around how to call the limit function based on which of the two values are set.
Basically,
If they are both set I want to call
$this->db->limit($take, $skip)
If only $take is set I want to call
$this->db->limit($take)
But what do I call if only $skip is set, e.g. if$skip = 10` then I want to show all rows, except for the first 10.
Do I call
$this->db->limit(null, $skip) or
$this->db->limit(0, $skip) or
$this->db->limit(false, $skip) or
something completely different?
I think you found the answer you were looking for by answering our own question but if you want to use codeigniter to get all rows except for the first 10 then you would need to do something like (I have yet to test it):
According to Mysql Documentation