Try mysql_fetch_assoc:
$json = array();
while ($row = mysql_fetch_assoc($result)) {
$json[$row['uid']] = array(
'lat' => $row['lat'],
'lon' => $row['lon'],
'loc' => $row['loc']
);
}
echo json_encode($json);
You should use MySQLi or PDO_MySQL instead of mysql_.
1
solved How to create json response