Postingan lainnya
data yang tampil [object object]
permisi para suhu, saya sedang menggunakan datatable dicodeigniter, dan sepertinya penerapan query saya ada yg salah karena data yg tampil selalu [object object]. berikut script yg saya gunakan
public function ajax_list_peneliti_perpostingan()
{
$list = $this->post->get_datatables_peneliti_perpostingan();
$data = array();
$no = $_POST['start'];
foreach ($list as $post) {
$no++;
$query = $this->db->query('SELECT count(postedby) FROM peneliti where postedby = "'.$post->postedby.'"');
$row_count = $query->result_array();
$row = array();
$row[] = $post->postedby;
$row[] = $row_count['0'];
$data[] = $row;
}
$output = array(
"draw" => $_POST['draw'],
"recordsTotal" => $this->post->count_all_peneliti_perpostingan(),
"recordsFiltered" => $this->post->count_filtered_peneliti_perpostingan(),
"data" => $data,
);
//output to json format
echo json_encode($output);
}
pada saya menampilkan variable $row_count[] = data yg muncul selalu object.. kira2 penerapan dimana yg saya salahnya. Thanks
dan ini data yg muncul pada consolenya
{"draw":"2","recordsTotal":481,"recordsFiltered":481,"data":[["administrator",{"count(postedby)":"1"}],["fadil",{"count(postedby)":"25"}],["",{"count(postedby)":"1"}],["tilan",{"count(postedby)":"160"}],["Editor",{"count(postedby)":"2"}],["budi",{"count(postedby)":"1"}],["admin",{"count(postedby)":"291"}]]}
0