制作一个多维数组php mysql

I link my last question to explain that i need

obtain results of two different tables mysql

This is the result of my mysql query.

date       | rate  | percent

2017-01-06    500      0
2017-01-07    500      0.10
2017-01-07    500      0.15

How can i make this array, i am tring with php but i can´t do this, i can do it with one dimension array, but no a multidimensional array like this

Array
(
    [1] => Array
        (
            [0] => Array
                (
                    [date] => 2017-01-06
                    [rate]=>500
                    [percent] => 0.00
                )

            [1] => Array
                (
                    [date] => 2017-01-07
                    [rate]=>500
                    [percent] => 0.10
                )   
    [2] => Array
        (
            [0] => Array
                (
                    [date] => 2017-01-06
                    [rate]=>500
                    [percent] => 0.00
                )

            [1] => Array
                (
                    [date] => 2017-01-07
                    [rate]=>500
                    [percent] => 0.15
                )

            )
)

It is a matter of (if I understand the problem) plucking the MAX() and MIN() percent values for each date. For this, you must use GROUP BY.

SELECT s.date, s.rate, MAX(p.percent) AS maxperc, MIN(p.percent) AS minperc
    FROM stock s
    LEFT JOIN promotions p ON s.date = p.date
    WHERE s.date BETWEEN '2017-01-29' AND '2017-01-31'
    GROUP BY s.date,s.rate;

...I haven't test that, so it may need some fiddling with.

Then as you loop through your result set, you can declare the two separate subarrays and build your complete array.

$array=[];
$i=0;
while($row=mysqli_fetch_assoc($result)){
    $array[0][$i]["date"]=$row["date"];
    $array[0][$i]["rate"]=$row["rate"];
    $array[0][$i]["perc"]=$row["minperc"];
    $array[1][$i]["date"]=$row["date"];
    $array[1][$i]["rate"]=$row["rate"];
    $array[1][$i]["perc"]=$row["maxperc"];
    ++$i;
}

By this point, I've made too many assumptions about your purpose/usage. Basically, set zero as the percent default, query for highest and lowest percent for each date-rate pair (if zero, then zero will appear as highest and lowest value). Do whatever you wish with the result set.