Welcome Guest, Not a member yet? Register   Sign In
Extracting foreign keys using active records
#1

[eluser]Patrick Reck[/eluser]
Hello!

I have a database with a user table, which contains some foreign keys to some properties about the user.

I'll use a simplified example.

users
Code:
| id | username | password | fk_eye_color | fk_hair_color |
-----------------------------------------------------------
|  1 | patrick  | mypassword |    1       |    1          |

properties_hair_colors
Code:
| id | hair_color |
--------------------
| 1 |     Brown    |

properties_eye_colors
Code:
| id | eye_color |
--------------------
| 1 |    Blue     |

As you can see, here's a user with Brown hair and Blue eyes. How can I extract this using Active Records?
#2

[eluser]InsiteFX[/eluser]
See:

CodeIgniter USers Guide - Active Record Class - $this->db->join();




Theme © iAndrew 2016 - Forum software by © MyBB