This is what I'd like to do, but it doesn't seem possible: (edit: changed single to double quotes)
function get_archives($limit, $offset)
{
$query = $this->db->query("
SELECT archivalie.id,
archivalie.signature,
type_of_source.description AS type_of_source_description,
media_type.description AS media_type_description,
origin.description AS origin_description
FROM archivalie,
type_of_source,
media_type,
origin
WHERE archivalie.type_of_source_id = type_of_source.id
AND type_of_source.media_type_id = media_type.id
AND archivalie.origin_id = origin.id
ORDER BY archivalie.id ASC
LIMIT $limit, $offset
");
// etc...
}
It gives this error: (edit: new error message using double quotes, and with an offset number passed in the URL)
ERROR: LIMIT #,# syntax is not supported HINT: Use separate LIMIT and OFFSET clauses.
It only works if you pass the variables using the ActiveRecord format:
$this->db->select('archivalie.id, archivalie.signature, etc, etc');
// from, where, etc.
$this->db->limit($limit, $offset);
$query = $this->db->get();