php nested do-while loop terminating after first iteration
<p>I'm using nested do-while loop for accessing two json result, unfortunately the loop terminates after the first iteration where it returns outer-loop json result and not executing the inner-loop. Please find the function where am using nested do-while loop:  </p>

<pre><code>public function data_report($fromdate, $todate)
{
  $lp = new log_report();
  $mysqli = new mysqli("172.16.10.102", "aventador", "RND@ISO-3306", "eTrans");
  if ($mysqli-&gt;connect_errno) 
  {
      $response["success"] = 0;
  }
  if (!$mysqli-&gt;multi_query("call sp_Android_Online_Dashboard('$fromdate','$todate')")) 
  {
      $response["success"] = 0;
  }

  else {
    //1st Iteration 
  do {  
    if ($res = $mysqli-&gt;store_result()) 
    {
        $response["values"] = array();  
        while ($row = $res-&gt;fetch_assoc()) 
        {
            $i=1;
            $value = array();
            $value["location_name"] = $row["location_name"];
            $value["location_id"] = $row["location_id"];
            $value["Totfiles"] = $row["Totfiles"];
            $arr = explode(":", $row["file_minutes"], 2);
            $value["file_minutes"] = $arr[0];
            $value["Total_Lines"] = round($row["Total_Lines"], 0, PHP_ROUND_HALF_UP);

            array_push($response["values"], $value);    

            echo $i++;
        }   
    if (!$mysqli-&gt;multi_query("call sp_get_Android_Online_minutes_Chart('$fromdate','$todate')")) 
    {
            $response["success"] = 0;

    }

    //2nd Iteration
    do {
            if ($res = $mysqli-&gt;store_result()) 
            {
                $response["Chart_data"] = array();  

                while ($row = $res-&gt;fetch_assoc()) 
                {
                    $j=5;
                    $value = array();
                    $value["File_Day"] = $row["FileDay"];
                    $value["File_Minutes"] = $row["Tot_minutes"];
                    array_push($response["Chart_data"], $value);    

                }
                    $response["success"] = 1; 
                    echo json_encode($response, JSON_NUMERIC_CHECK);
                    $res-&gt;free();
                }

                echo $j++;

               } while($mysqli-&gt;more_results() &amp;&amp; $mysqli-&gt;next_result());
           }

            echo json_encode($response, JSON_NUMERIC_CHECK);    

        } while($mysqli-&gt;more_results() &amp;&amp; $mysqli-&gt;next_result()); 
    }
  }
</code></pre>

<p>Please help me out in solving this issue, thanks in advance!!</p>