join problem - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: join problem (/showthread.php?tid=9335) |
join problem - El Forum - 06-22-2008 [eluser]Jim-Bingo[/eluser] Hi! I have a problem with my Join. Code: $this->db->select('*, news.date as newsdate, news.content as newscontent'); I want it to print out the news and all comments that belong to it. Like this News 1 comment comment comment News 2 comment comment News 3 comment comment How do I do that? Hope you understand. Sorry for my bad english. join problem - El Forum - 06-22-2008 [eluser]Developer13[/eluser] About the only thing I see wrong with the query as you have it is you don't have anything being explicitly selected from the news_comments table. Add news_comments.comment (or whatever) to your select statement. Otherwise, what specifically is the problem? join problem - El Forum - 06-23-2008 [eluser]Jim-Bingo[/eluser] I donĀ“t know how to print it out. I think I need to use two loops. One for the news and another one inside for the comments. Is that right? |