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

[eluser]Bainzy[/eluser]
Hey guys,

little stuck here at the moment what I am trying to do is create a forum using codeigniter. Now I got the basic forum working using a few queries I am trying to make the code neater and more effiient. what I have is the forum home page here I used two tables to contain my data a "topics" table and a "category" table.

On the forum home screen I use two queries 1 to return the following information :

TopicName,
CreatedBy,
Topics,
LastPost,

then I would use a second query to retreive the following from the category table

CategoryName

Now I modified my code to do the following using a join query

function fetchForumJoinRow()
{

$this->db->select('*');
$this->db->from('topics');
$this->db->join('category', 'category.CategoryID = topics.CategoryID');

$query = $this->db->get();
return $query->result_array();
}

now this code works fine for getting me the category name for use on the home page in a single query but how can I now add the pagination into this because whe I try it forms a error. ?


Messages In This Thread
Pagination with join - by El Forum - 01-23-2010, 10:36 AM
Pagination with join - by El Forum - 01-23-2010, 12:24 PM
Pagination with join - by El Forum - 12-08-2010, 09:58 AM



Theme © iAndrew 2016 - Forum software by © MyBB