[eluser]mvdg27[/eluser]
Hehe .. no problem. I'm sure I didn't explain it completely right either as I'm struggling with it myself as well

Thanks for trying to help at least!
The following tables exist in my database:
comments:
id - INT, autoincrement
section_id - INT
page_id - INT
comment - TEXT
The combination of section_id and page_id indicates to which specific page the comment belongs to (e.g. section_id = 1, page_id = 2, refers to the page 'About us' on the English website).
sections:
id - INT, autoincrement
name - string
This table keeps track of the existing sections. For example id 1 refers to 'Website english', and 2 refers to 'Website dutch', and 3 refers to 'Photo album', etc.
Then for each section, a new table is created to store the actual content for that section (i.e. website pages, or in case of a photo album, a photo). The table is always named after the id of that section, as such: 'section1', 'section2', 'section3', etc. The exact number of columns may differ per section, but at the very least they have the following two columns:
section1:
id - INT, autoincrement
name - string
Ok, now the thing I'm after is this:
I want to create a database result of the comments:
Code:
$query = $this->db->get('comments');
$result = $query->result('array');
But instead of displaying the section_id (a number) I want to display the appropriate name of that section (Website english, photoalbum, etc). And instead of th page_id (a number) I want to display the page name (About us, photo 1, etc).
The section names will always be fetched from the table 'sections'. But the page name should be fetched from a table that is dependent of the section_id. And that last part is sort of the problem ...
I hope I explained a bit better now .. if not, I'll give it another go
Thanks again.
Michiel