Reputation: 117
this my controler
public function ajax_pasien($Kode)
{
$data = $this->infokamar->get_by_id1($Kode);
echo json_encode($data);
}
this my model
public function get_by_id1($Kode)
{
$sql = "select a.norm, b.nama as pasien, b.alamat, c.tanggal, c.tanggal1, f.jumlah, f.biaya from TTKunjungan a inner join TMPasien b on A.norm = b.norm inner join TTKunjunganDetail c on A.Kode = c.kodekunjungan inner join TMTrfTindakan d on c.kodetindakan = d.Kode inner join TMTrfLayanan e on d.kodelayanan = e.Kode left join (select kodett, sum(jumlah) as jumlah, sum(biaya) as biaya from TTKunjunganDetail where kodett is not null group by kodett) f on c.Kode = F.kodett Where e.kodeklasifikasi = 2 and c.tanggal1 is null and c.kodett is null and c.kodetindakan = '{$Kode}'";
$query = $this->db->query($sql);
return($query->result_array());
}
and this my view but nothing show
Upvotes: 1
Views: 55
Reputation: 462
The best way to check your queries is by two ways:
1. Printing the last query Use below code to print last executed query
<?php echo $this>db->last_query() ?>
2. Enable profiler Make sure your output class is loaded/autoloaded. Just enable profiler in your controller's constructor by adding below code and see the magic after rendering the page
$this->output->enable_profiler(true)
-Cheers
Upvotes: 1
Reputation: 6994
Send data from controller to your respective view as follows in controller..
public function ajax_pasien($Kode)
{
$data = $this->infokamar->get_by_id1($Kode);
//echo json_encode($data);
$this->load->view('view_name',$data);
}
Upvotes: 0