mysqli multi query retrieve multiple results
<p>I am executing a multi_query in my php code and want to echo the results in a table. The query works as expected and produces the desired output, however when I echo the data the while loop seems to stop after one iteration.</p>

<p>Here is the code I want to use:</p>

<pre><code>if (mysqli_multi_query($db_conx, $sql)) {
do {
    /* store first result set */
    if ($result = mysqli_store_result($db_conx)) {
        while ($row = mysqli_fetch_row($result)) {
            $cur = $row[1];
            $date = $row[7];
            $et = $row[9];
            $result = $row[13];
            $payout = $row[15];
            echo '&lt;tr&gt;
                    &lt;th class="text-center" scope="row"&gt;'. $cur .'&lt;/th&gt;
                    &lt;td&gt;'. $date .'&lt;/td&gt;
                    &lt;td&gt;'. $et .'&lt;/td&gt;
                    &lt;td&gt;'. $result .'&lt;/td&gt;
                    &lt;td&gt;'. $payout .'&lt;/td&gt;
                &lt;/tr&gt;';
        }
        mysqli_free_result($result);
    }
} while (mysqli_next_result($db_conx));
}
</code></pre>

<p>Running this code will return the first row of the table just fine, but nothign thereafter. When I tested some stuff, I noticed I am able to retrieve/echo all the contents if I only reference to one of the rows like so:</p>

<pre><code>if (mysqli_multi_query($db_conx, $sql)) {
do {
    /* store first result set */
    if ($result = mysqli_store_result($db_conx)) {
        while ($row = mysqli_fetch_row($result)) {
            $cur = $row[1];
            echo $cur;
            echo '&lt;br&gt;';
        }
        mysqli_free_result($result);
    }
} while (mysqli_next_result($db_conx));
}
</code></pre>

<p>Can anyone help me out? I very much appreciate the help! </p>

<p>UPDATE: Below the query I am using (conditional values hardplugged for test reasons)</p>

<pre><code>SET @row_number_t1:=0;
SET @row_number_t2:=0;

    CREATE TEMPORARY TABLE IF NOT EXISTS t1 AS (
    SELECT cur,date,time_start FROM `cur1` WHERE sig = 5
    );

    INSERT INTO t1
        SELECT cur,date,time_start FROM `cur1` WHERE (sig = 1 OR sig = 2) AND error_code = 0 AND date &gt;= '2016-02-01' AND date &lt;= '2016-02-010'
        UNION SELECT cur,date,time_start FROM `cur2` WHERE (sig = 1 OR sig = 2) AND error_code = 0 AND date &gt;= '2016-02-01' AND date &lt;= '2016-02-010'
    ORDER BY time_start ASC, date;


    SELECT t1_modif.*, t2_modif.* FROM 
        (SELECT @row_number_t1:=@row_number_t1+1 AS row_number1,
            cur,time_start FROM t1) 
            t1_modif
        JOIN (SELECT @row_number_t2:=@row_number_t2+1 AS row_number2,
        trades.* FROM trades WHERE date &gt;= '2016-02-01' AND date &lt;= '2016-02-010'
        ORDER BY startTime ASC, date) 
        t2_modif ON t2_modif.row_number2 = t1_modif.row_number1;
</code></pre>