why does the data only display the first column? my nestedData array is mounted wrong?
why does the data only display the first column? my nestedData array is mounted wrong?
...
$sql = "SELECT * FROM acao WHERE 1 = 1 ";
$sql .= $filter;
$sql .=" ORDER BY " . $columns[$requestData['order'][0]['column']] . " " . $requestData['order'][0]['dir'] . " LIMIT " . $requestData['start'] . " ," . $requestData['length'] . " ";// adding length
$query = $sqlite_db->query($sql) or die("Erro no sql: BF_acessoBdSqlite_acao.php: get acao");
$data = array();
foreach ($sqlite_db->query($sql) as $row) { // preparing an array
$nestedData=array();
$nestedData[] = $row["ID"];
$nestedData[] = $row["NOME"];
$nestedData[] = $row["CMT"];
$nestedData[] = $row["MRID"];
$data[] = $nestedData;
}
// Cria o objeto json: json_data
$json_data = array(
"draw" => intval( $requestData['draw'] ), // same number for every request/draw by clientside
"recordsTotal" => intval( $totalData ), // total number of records
"recordsFiltered" => intval( $totalFiltered ), // total number of records after searching
"data" => $data // searches the data according to search parameters, sort, column names
);
Answers
See if this nest objects example helps. If not then use the browser's network inspector to get an example of the JSON response so we can see what your data structure looks like.
Kevin
Thanks Kevin. I'll try to examine the json response as soon as I get access to the machine I'm running it on.
I was able to inspect the Assembled array and it's really only assembling information in the first column when that's the id. Can you give me any tips on what I'm doing wrong?
... My filter...
$filter = "";
if( !empty($requestData['search']['value']) ) {
$filter .=" AND (id LIKE '" . $requestData['search']['value'] . "%' ";
$filter .=" OR nome LIKE '" . $requestData['search']['value'] . "%' ";
$filter .=" OR cmt LIKE '" . $requestData['search']['value'] . "%' ";
$filter .=" OR mrid LIKE '" . $requestData['search']['value'] . "%' ) ";
}