Welcome Guest, Not a member yet? Register   Sign In
problem with db, Join and Limit
#1

[eluser]martialou[/eluser]
Hi all,

First post here!

I have some problems using a query with Join and Limit for a pagination.
I really can't figure out why this is not working.

Right now I have 6 posts - so if I add a limit to 5, It should return me 5 posts right ?
Well using this code I get only 2 posts!

Also if I add

Code:
$this->db->limit(5,5);

Nothing is returned.

Any ideas ?

Many thanks

Code:
$this->db->select('*');
$this->db->from($this->table); // select all keys
$this->db->join($this->data_table, $this->data_table.'.'.$data_table_prefix.'='.$this->table.'.id'); // join the tables where content_data.content_key_id = content_key.id
        
$this->db->limit(5);

$this->db->where($fields);// filter the results by fieds
if ( $order ) $this->db->order_by("order", "desc");

$query = $this->db->get();
$result = $query->result_array();
$query->free_result();
return $result;
#2

[eluser]martialou[/eluser]
Ok - I'm not able to delete the post..
But no worries there was some nasty bug hidden somewhere..

Don't read it!




Theme © iAndrew 2016 - Forum software by © MyBB