0

moviedirectorの2 つのテーブルがあり、movie のテーブルには ' director1 ' と ' director2 'の 2 つのフィールドがあります。

内部結合を使用して2つのテーブルを一致させましたが、「ディレクター」のフィールド「名前」と「姓」のforeachを実行すると、最後の結果が1つしか得られません。

これは私のモデルです:

function getLastMoviesId($id)
    {
        $this->db->select('*');
        $this->db->from('movie as m');
        $this->db->join('director as d1', 'd1.id = m.director1');
        $this->db->join('director as d2', 'd2.id = m.director2');
        $this->db->where('m.id', $id);
        $query = $this->db->get();
        if($query->num_rows() > 0){
          return $query->result();
        } else {
          return 0;
        }   
    }

これは私の見解です:

<?php foreach ($archivepage as $m): ?>
  <?= html_entity_decode($m->name) ?>
  <?= html_entity_decode($m->surname) ?>
<?php endforeach ?>
4

1 に答える 1