Select from two different tables with same fieds name |
Hi everybody,
so excited for my first post on this forum . I am Trying to implement a select and join using the Active Record class from two tables, conversations and users, where conversations.user = users.id. So I compose the query on this way: $this->db->from('conversations'); $this->db->where('recipients',$id); $this->db->join('users', 'conversations.user = users.id'); $query = $this->db->get(); return $query->result(); The result is fine I get all the row I need, but, problems comes when I use the data on the view, cause after that if I try to print the conversation id I get the user id instead. <?= $message->id ?> --> Here is the user id instead of the conversation id. Looks like the last id replaces the first . Can somebody show me ho to compose the query for getting both the two ids but with different identifier ? So I may get them on my view writing something like that: <?= $message->id ?> <?= $message->iduser ?> limailmirino |
Messages In This Thread |
Select from two different tables with same fieds name - by limailmirino - 03-05-2015, 04:55 PM
RE: Select from two different tables with same fieds name - by RobertSF - 03-05-2015, 05:32 PM
RE: Select from two different tables with same fieds name - by silentium - 03-05-2015, 07:05 PM
RE: Select from two different tables with same fieds name - by limailmirino - 03-07-2015, 03:31 PM
|