Welcome Guest, Not a member yet? Register   Sign In
2 tables, need to select a value from the 2nd to help with the 1st
#3

[eluser]fancms[/eluser]
Thanks so much, xwero Big Grin Much appreciated!!

For anyone else who might happen to question how to set this up using Template Lite, here's what my code looks like:

In Controller:
Code:
$query = $this->db->query("SELECT t1.subject,t1.article,t2.name from news as t1, newscats as t2 where t1.cat=t2.id");
$this->tlite->assign("articles", $query->result_array());

In Template File:
Code:
{foreach item=art from=$articles}
{$art.subject}<br />
{$art.name}<br /> #<--That would be the category name; took me a bit to figure that out :)
{$art.article}
{foreachelse}
No articles
{/foreach}


Messages In This Thread
2 tables, need to select a value from the 2nd to help with the 1st - by El Forum - 10-27-2007, 12:24 PM



Theme © iAndrew 2016 - Forum software by © MyBB