Welcome Guest, Not a member yet? Register   Sign In
relational DB
#2

[eluser]CroNiX[/eluser]
http://ellislab.com/codeigniter/user-gui...ecord.html

Check out the $this->db->join() section and example.


Or a simple one for you...

BLOG
----
-id
-title
-category_id

CATEGORIES
----------
-id
-name
Code:
$result = $this->db
  ->select('BLOG.title AS title, CATEGORIES.name AS category')
  ->join('CATEGORIES', 'CATEGORIES.id = BLOG.category_id')
  ->get('BLOG')
  ->result_array();

would give you an array of all blog titles along with its category name.


Messages In This Thread
relational DB - by El Forum - 07-10-2011, 12:14 PM
relational DB - by El Forum - 07-12-2011, 01:29 PM



Theme © iAndrew 2016 - Forum software by © MyBB