0
Hello,
I’m trying to show the name of a channel associated with an event through a FK, but I can’t show it.
Model:
public function get_events() {
$this->db->get('events');
$this->db->join('channels', 'events.channel_id = channels.id');
$this->db->join('colors', 'channels.color_id = colors.id');
return $query = $this->db->get('events')->result();}
View:
foreach($events as $event){
echo '<tr class="odd gradeX">';
echo "<td>".$event->start." - ".$event->end."</td>";
echo '<td class="center">'.$event->channels->name.'</td>';
echo '<td class="center">'.$event->status_id.'</td>';
echo "</tr>";}
Any suggestions?
Does not display the records or they come wrong?
– rray
This Return $query. Place: Return $this->db->get('Events')->result();
– Sr. André Baill
I can see everything from the first entity, Events, but if I want to show from the second entity, Channels I can’t.
– brunofcat