I'm doing some db querys using ActiveRecord and i need to paginate the results so i do a
$this->db->limit($pPagination['Start'], $pPagination['Length']);
but i don't get any results. Using $this->db->last_query();
it seems that CodeIgniter produces the following SQL
SELECT *
FROM (`viw_contacts`)
WHERE `user_id` = '1'
ORDER BY `contact_name` asc
LIMIT 0 OFFSET 15
which when i run it inside PHPMyAdmin also returns 0 rows.
But if i modify it an run :
SELECT *
FROM (`viw_contacts`)
WHERE `user_id` = '1'
ORDER BY `contact_name` asc
LIMIT 0, 15
Then i get the correct results. Any ideea why CodeIgniter generates this SQL and why it doesn't work?
I use CodeIgniter 1.7.3 and MySQL 5.1.41