Исходная версия:
Код: Выделить всё
$query = $this->db->query('SELECT tb.*,b.`property` FROM `email_template_blocks` as tb inner join email_blocks as b on tb.`block_id`=b.`id` where tb.template_id=' . $id);
if ($query->num_rows() < 1) {
return null;
}
return $query->result_array();
Код: Выделить всё
$this->db->select('*');
$this->db->from('email_template_blocks');
$this->db->join('email_blocks', 'email_template_blocks.block_id = email_blocks.id', 'inner');
$this->db->where('email_template_blocks.template_id', $id);
$query = $this->db->get();
//$query = $this->db->query('SELECT tb.*,b.`property` FROM `email_template_blocks` as tb inner join email_blocks as b on tb.`block_id`=b.`id` where tb.template_id=' . $id);
if ($query->num_rows() < 1) {
return null;
}
return $query->result_array();
Мне также хотелось бы знать, как выбрать все элементы из таблицы email_template_blocks и просто присоединиться к столбцу свойств таблицы email_blocks.
Таблица блоков шаблона электронной почты:
схема таблицы
Таблица блоков электронной почты:
схема таблицы
Подробнее здесь: https://stackoverflow.com/questions/496 ... no-results
Мобильная версия