Welcome Guest, Not a member yet? Register   Sign In
does ci support relational db

hi, i m new to ci and i can't figure out how does ci work with relational db. I mean i have 2 tables in db and 1 table has id of another table's content, how do i get another content using that tables id? i have to use loop to echo the content of the 1st table, so can't use another loop, just confused, if u need db structure i can provide.

[eluser]Bart v B[/eluser]
i don't understand youre question.
a relational database has nothing to do with CI or other frameworks.

You want to JOIN two table together, with active Records i gues..

Take a look in the manual Wink

$this->db->join('comments', 'comments.id = blogs.id');

$query = $this->db->get();

// Produces:
// SELECT * FROM blogs
// JOIN comments ON comments.id = blogs.id

I would not recomend this example, but just play with it.

just build your query around it.

$this->db->select('u.first_name, u.last_name, a.street, a.city, a.state, a.zip');
$this->db->from('users u');
$this->db->join('addresses a','a.user_id = users.id');
$results = $this->db->get();

thank u all

You could also try an ORM. Search the forums for DMZ, RapidDataMapper or Doctrine.

Theme © iAndrew 2016 - Forum software by © MyBB