Welcome Guest, Not a member yet? Register   Sign In
Joins: Controller or Model?
#6

[eluser]dark_lord[/eluser]
Actually you can use traditional SQL Statement in CodeIgniter to create join statements much easier (as for me) to replace the built in active record methods found in CI, you can refer on this part of the CI User Guide (found in the below link).

Code:
$query = $this->db->query("SELECT b.fieldA as fieldA, b.fieldB FROM table1 a, table2 b WHERE a.id = b.id");

foreach ($query->result() as $row)
{
    echo $row['fieldA'];
}

http://ellislab.com/codeigniter/user-gui...eries.html

Let me know if it helps!


Messages In This Thread
Joins: Controller or Model? - by El Forum - 03-02-2010, 08:50 AM
Joins: Controller or Model? - by El Forum - 03-02-2010, 08:54 AM
Joins: Controller or Model? - by El Forum - 03-02-2010, 10:08 AM
Joins: Controller or Model? - by El Forum - 03-02-2010, 03:12 PM
Joins: Controller or Model? - by El Forum - 03-03-2010, 12:45 PM
Joins: Controller or Model? - by El Forum - 03-03-2010, 01:03 PM
Joins: Controller or Model? - by El Forum - 03-03-2010, 05:28 PM
Joins: Controller or Model? - by El Forum - 03-04-2010, 11:01 AM
Joins: Controller or Model? - by El Forum - 03-04-2010, 11:13 AM
Joins: Controller or Model? - by El Forum - 03-04-2010, 05:21 PM



Theme © iAndrew 2016 - Forum software by © MyBB