CodeIgniter Forums

Full Version: Pagination with joined table
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

El Forum

[eluser]Wonder Woman[/eluser]

I had my pagination working but then the structure of the database changed so it now doesn't work because I have to join two tables to get the results I once had...

My db script is:

$query = $this->db->select('*');
$query = $this->db->from('user_entry');
$query = $this->db->join('user_details', 'user_entry.UserID =');
$query = $this->db->limit($limit, $offset);
$query = $this->db->get();

If you could help me, I would be so grateful - thanks.

El Forum

[eluser]Cristian Gilè[/eluser]
This is the right way to write the query:

$query = $this->db->select('*')
                  ->join('user_details', 'user_entry.UserID =')
                  ->limit($limit, $offset)

We can't do much to help you only with the query code.

Cristian Gilè