Welcome Guest, Not a member yet? Register   Sign In
Pagination with joined table
#1

[eluser]Wonder Woman[/eluser]
Hi

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:

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

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

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

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

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


Cristian Gilè




Theme © iAndrew 2016 - Forum software by © MyBB