在PHP中运行两个多行查询

I am trying to run the following php script

    $maxmonth = date('m');
    $maxyear = date('Y');
    $sql = "SET @cmonth = 1;
            SET @cyear = 2015;
            SET @maxmonth = ".$maxmonth.";
            SET @maxyear = ".$maxyear.";

            CALL insertBills(@cyear,@cmonth,@maxyear,@maxmonth);";
    multiQuery($sql);

    $sql = "SET @cfmonth = 1;
            SET @cfyear = 2015;
            SET @maxfmonth = ".$maxmonth.";
            SET @maxfyear = ".$maxyear.";
            CALL insertFees(@cfyear,@cfmonth,@maxfyear,@maxfmonth);";
    multiQuery($sql);

The problem is the only one of them runs at a time. If I disable the first one, the second one works however both are not executed in one page refresh.

function multiQuery($sql) {
    global $dbi_connection;
    $dbi_result = mysqli_multi_query($dbi_connection,$sql);

    return $dbi_result;
}

Looking at how mysqli_multi_query works, you need to put your queries concatenated by a semicolon and then send that single query to the function.

Right now you are sending the two queries separately so it will only do one query at a time.