<p>Everything you need to know is in the <a href="http://buildwithcraft.com/docs/relations" rel="nofollow">Relations</a> part of the official documentation.</p>

<p>You essentially want to add an <a href="http://buildwithcraft.com/docs/entries-fields" rel="nofollow">Entries</a> field to your <code>Courses</code> channel and then when you set it up pick <code>Instructors</code> as the source. If you only want to pick one instructor, just set the <code>limit</code> to 1. How you then use this in the templates can be found <a href="http://buildwithcraft.com/docs/entries-fields#templating" rel="nofollow">here</a>. </p>

CC BY-SA 3.0
2015-06-11T00:34:41.783Z
So I've tried using the code `{% for entry in entry.instructor %} ... {% endfor %}` but all I get is a 500 Fatal error. I was using the documentation before but as I mentioned above I can't seem to figure out the precise code that would get it to work and the documentation has so much assumed knowledge that I can't figure it out.
JeffTalbot
CC BY-SA 3.0
2015-06-11T00:45:33.080Z
I've tried many other variations like `{% for instructors in courses.instructor %} ... {% endfor %}` but none seem to work. To me that code is exactly like the example `{% for ingredient in cocktail.ingredients %}
            <li>{{ ingredient.getLink() }}</li>
        {% endfor %}` but it doesn't work and I really don't understand why...
JeffTalbot
CC BY-SA 3.0
2015-06-11T00:54:00.900Z
So the winner is `{% for instructors in entry.instructor %}` I found that also there was come other code from when the instructor field was just a text field that was causing issues. Thanks for the help.
JeffTalbot
CC BY-SA 3.0
2015-06-11T08:50:01.853Z
Glad you got it sorted in the end. It's because you can have one or many in your relationship so an array is returned. I don't know how many instructors you are assigning to each course, but if there was only ever one you could use `{% set instructor = entry.instructor.first() %}` which would bring you back just the one, or `null` (I think) if you haven't yet assigned one.
Steve Holland
CC BY-SA 3.0
2015-06-10T08:40:16.867Z
2015-06-10T11:46:13.320Z
2015-06-10T11:46:13.320Z
Steve Holland
<p>I have two channels, Courses and Instructors. In Courses I'd like to have a an entries field called "Instructor" so that this will display on the courses page.</p>

<p>I can't seem to figure out how to do this. I have found a few tutes but nothing I have tried has worked. Whats the best way of doing this?  </p>

<entries>
Trying to relate 2 Entries together
# Trying to relate 2 Entries together

(Asked by: username_0 on 2015-06-10)

I have two channels, Courses and Instructors. In Courses I'd like to have a an entries field called "Instructor" so that this will display on the courses page.

I can't seem to figure out how to do this. I have found a few tutes but nothing I have tried has worked. Whats the best way of doing this?

**Tags:** entries


---

## 1 answers

### Answer by username_1 on 2015-06-10. Score: 4 | Accepted answer

Everything you need to know is in the [Relations](http://buildwithcraft.com/docs/relations) part of the official documentation.

You essentially want to add an [Entries](http://buildwithcraft.com/docs/entries-fields) field to your `Courses` channel and then when you set it up pick `Instructors` as the source. If you only want to pick one instructor, just set the `limit` to 1. How you then use this in the templates can be found [here](http://buildwithcraft.com/docs/entries-fields#templating).

> **Comments:**
> **username_0**: So I've tried using the code `{% for entry in entry.instructor %} ... {% endfor %}` but all I get is a 500 Fatal error. I was using the documentation before but as I mentioned above I can't seem to figure out the precise code that would get it to work and the documentation has so much assumed knowledge that I can't figure it out.  
> **username_0**: I've tried many other variations like `{% for instructors in courses.instructor %} ... {% endfor %}` but none seem to work. To me that code is exactly like the example `{% for ingredient in cocktail.ingredients %}             <li>{{ ingredient.getLink() }}</li>         {% endfor %}` but it doesn't work and I really don't understand why...  
> **username_0**: So the winner is `{% for instructors in entry.instructor %}` I found that also there was come other code from when the instructor field was just a text field that was causing issues. Thanks for the help.  
> **username_1**: Glad you got it sorted in the end. It's because you can have one or many in your relationship so an array is returned. I don't know how many instructors you are assigning to each course, but if there was only ever one you could use `{% set instructor = entry.instructor.first() %}` which would bring you back just the one, or `null` (I think) if you haven't yet assigned one.  

---

