1

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

enter image description here

2
  • Instead of echo try to use var_dump. But share some view code here. Commented Dec 28, 2016 at 5:13
  • see my answer hope it will help you Commented Dec 28, 2016 at 5:27

2 Answers 2

1

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

Sign up to request clarification or add additional context in comments.

Comments

0

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);
    }

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.