-
Anonymous
Как правильно присоединиться к таблицам в codeigniter
Сообщение
Anonymous »
Это мои модели < /p>
Код: Выделить всё
function report($where = '')
{
$this->db->select(array('o.id_order AS id_order', 'nama_pemesan', 'kota', 'total', 'SUM(biaya) AS do.biaya'));
$this->db->from('t_order o JOIN t_detail_order do ON (o.id_order = do.id_order)');
$this->db->where($where);
$this->db->group_by('o.id_order');
return $this->db->get();
}
< /code>
Это моя таблица t_order < /p>
t_dord < /p>
это моя таблица t_detail_ord /> ошибка < /p>
Это мой отчет о контроллере < /p>
Отчет об публичной функции ()
{
$ this-> load-> библиотека ('form_validation');
$ this-> cek_login ()
$ this-> cek_login (' /p> p> p> pr />
$ this-> cek_login (' 'form_validation');
$ this-> cek_login ('' form_validation '); if ($this->input->post('submit', TRUE) == 'Submit')
{
$this->form_validation->set_rules('bln', 'Bulan', 'required|numeric');
$this->form_validation->set_rules('thn', 'Tahun', 'required|numeric');
if ($this->form_validation->run() == TRUE)
{
$bln = $this->input->post('bln', TRUE);
$thn = $this->input->post('thn', TRUE);
}
} else {
$bln = date('m');
$thn = date('Y');
}
//YYYY-mm-dd
//2017-04-31
$awal = $thn.'-'.$bln.'-01';
$akhir = $thn.'-'.$bln.'-31';
$where = ['tgl_pesan >=' => $awal, 'tgl_pesan
Подробнее здесь: [url]https://stackoverflow.com/questions/50121987/how-to-join-tables-correctly-in-codeigniter[/url]
1755983806
Anonymous
Это мои модели < /p>
[code]function report($where = '')
{
$this->db->select(array('o.id_order AS id_order', 'nama_pemesan', 'kota', 'total', 'SUM(biaya) AS do.biaya'));
$this->db->from('t_order o JOIN t_detail_order do ON (o.id_order = do.id_order)');
$this->db->where($where);
$this->db->group_by('o.id_order');
return $this->db->get();
}
< /code>
Это моя таблица t_order < /p>
t_dord < /p>
это моя таблица t_detail_ord /> ошибка < /p>
Это мой отчет о контроллере < /p>
Отчет об публичной функции ()
{
$ this-> load-> библиотека ('form_validation');
$ this-> cek_login ()
$ this-> cek_login (' /p> p> p> pr />
$ this-> cek_login (' 'form_validation');
$ this-> cek_login ('' form_validation '); if ($this->input->post('submit', TRUE) == 'Submit')
{
$this->form_validation->set_rules('bln', 'Bulan', 'required|numeric');
$this->form_validation->set_rules('thn', 'Tahun', 'required|numeric');
if ($this->form_validation->run() == TRUE)
{
$bln = $this->input->post('bln', TRUE);
$thn = $this->input->post('thn', TRUE);
}
} else {
$bln = date('m');
$thn = date('Y');
}
//YYYY-mm-dd
//2017-04-31
$awal = $thn.'-'.$bln.'-01';
$akhir = $thn.'-'.$bln.'-31';
$where = ['tgl_pesan >=' => $awal, 'tgl_pesan
Подробнее здесь: [url]https://stackoverflow.com/questions/50121987/how-to-join-tables-correctly-in-codeigniter[/url]