0
У меня возникли проблемы с объединением двух запросов activerecord. Нескомментированный код показывает, что на самом деле работает, и код с комментариями отображает то, что я считаю кодом. Очевидно, что код с комментариями должен быть в цикле.Ищет помощь при подключении запросов в CodeIgniter
$musicQuery = "album1,album2,album3,album4");
$albums = explode(",", $musicQuery);
foreach($albums as $i => $album) {
$albumQuery = $this->db->get_where('albums', array('id' => $album), 1)->row_array();
$artistQuery = $this->db->get_where('artists', array('tc_id' => $albumQuery['artist']), 1)->row_array();
echo $artistQuery['artist'].'<br>';
}
// This is what I thought I would need
//$this->db->select('*');
//$this->db->from('albums');
//$this->db->join('artists', 'artists.id = albums.artist');
//$this->db->where('id', $album);
//$this->db->limit(1);
//$this->db->order_by("post_views", "desc");
//$artistQuery = $this->db->get();