Welcome Guest, Not a member yet? Register   Sign In
Need help on my Database Structure
#1

[eluser]Gwarrior[/eluser]
I have two databases:

Fields
Quote:FIELD_ID
main_id (which is POSTS ID)
name
description
value

Posts
Quote:ID
type
post_parent
is_approved
comment_count
author
trackback
post_date
post_name
page
title
description

Now all I want to do is run a query and foreach the results where all data is available. Obviously a JOIN, but how would it be done? I've been toying with it all morning.

Thanks!
#2

[eluser]imn.codeartist[/eluser]
Try this code in your model it joins the table and returns the result

Code:
$this->db->from('Fields fld');
$this->db->join('Posts pst','fld.main_id=pst.ID');
$resultset=$this->db->get();
return $resultset->result();




Theme © iAndrew 2016 - Forum software by © MyBB