From the beginning, I would ask, “What doesn’t work?” . Secondly, I suggest starting the profiler to show you EXACT SQL , so that you can make a reliable assessment of where the ACTIVE QUESTION fails.
To use the profiler, insert it into your controller:
$this->output->enable_profiler(TRUE);
This will lead to a good output of all database calls, all POST-vars, etc.
Link here: http://codeigniter.com/user_guide/libraries/output.html
UPDATE
To fully accomplish what you need, you need a query that returns the following columns:
user_id, username, topic_id, topic_name, quote_id, quote_name
Here is the active query that you want (you can also use a chain of methods if this is clear enough):
$this->db->select('u.user_id, u.username, t.topic_id, t.topic_name, q.quote_id, q.quote_name'); $this->db->from('users u'); $this->db->join('topics t', 't.user_id = u.user_id');
Then your result will be as follows:
user_id | username | topic_id | topic_name | quote_id | quote_name 1 |Thomas |1 |Whatever |1 |One quote, anot... 2 |Ryan |4 |Another... |6 |To be or not to...
Once you have this set of results, just skip the data for its output and check if you have several quotes from the same person (say, sort by user_id and run the test in the second cycle if its the same person otherwise print the name of the new user).