Hi i have been looking through the forums and can't find anything about making a json array with php that prints anything like the json i have seen here?
This is my php that prints valid json.
$json_data = array();
while ($row = mysql_fetch_assoc($sql)) {
array_push($json_data, $row);
}
$json_data = json_encode($json_data);
echo $json_data;
The output look like this.
[{"id1":"data1","id2":"data2","id3":"data3","id4":"data4","id5":"data5",""id6":"data6","id7":"data7","id8":"data8","id9":"data9","id10":"data10","id11":"data11","id12":"data12","id13":"data13"}]
After this i make an ajax request for the page.
This dose not work all the json arrays i have seen have ([]) not ("") how can i get php to format it like it should be for construct.