Hi
This is the array im working on
$x = 0;
while($row = mysql_fetch_object($sql_result) )
{
$json[$x] = array (
$json[$x] = array (
'id' => $row->fid,
'rel' => $row->ftype,
),
"data" => $row->ftitle,
"state" => ""
);
$x++;
}
echo json_encode($json);
Open in new window
this out put is like
[{"0":{"id":"3","rel":"file"},"data":"file1.doc","state":""},{"0":{"id":"4","rel":"file"},"data":"filetest.doc","state":""}]
Open in new window
i have no idea why "0" appear on output.
is there way to replace "0" with "attr" ?
any help would be great.
Thanks