query($sql); while($row = $result->fetch_assoc()) { array_push($total_arr, $row); } echo json_encode(array( "code" => 200, "data" => $total_arr ));