I want to get json with php encode function like the following
build it all into an array first, then encode the whole thing in one go:
$outputdata = array(); while($row = mysql_fetch_array($result)) { $outputdata[] = $row; } echo json_encode($outputdata);