header('content-type:application/json;charset=utf8');
$results = array();
while ($row = mysql_fetch_assoc($result_query)) {
$results[] = $row;
}
if($results){
echo json_encode($results);
}else{
echo mysql_error();
}
//当查询单条时,也可用此
$rs=mysqli_fetch_assoc($q);
$rs=json_encode($rs);
print_r($rs);