Query with multiple tables and foreach |
[eluser]Unknown[/eluser]
Hello I'm new to CI and the concept of MVC. I have some difficult to list a query with multiple tables and foreach in correct way. Lets say I have three tables: Country - State - City Example of an easy (for me) and wrong way to list these tables: Controller Code: class Pagelist extends Controller { Code: <!-- ========== List =========== --> Since i can't make queries in view, how make the other 2 queries with comparison in a loop outside view? I tried to do a multiple array manually, but in the real case is so complicated to list. Any ideas on an easy way to do? Sorry for my poor english
[eluser]pistolPete[/eluser]
Since you are using a relational database, you should use its features. Have a look at the SQL join statement: http://www.w3schools.com/Sql/sql_join.asp
[eluser]jedd[/eluser]
You might also want to post your db schema, and a rough idea of what kind of output you're looking to achieve. |
Welcome Guest, Not a member yet? Register Sign In |