my JSON data returned in brackets, for example: [{"cust_id":"109"}]. Why is this? I tried mysql_fetch_rowand mysql_fetch_object. Does the substring need to remove the brackets?
Also, how can I render a JSON object in javaScript? In Firebug, if I program JSON data hard, I see the value as JSON, but alert () will not show it.
Thank.
$rows = array();
while($r = mysql_fetch_assoc($rs)) {
$rows[] = $r;
}
echo json_encode($rows);
source
share