I have a PHP script that prepares 3 different SQL submissions. The SQL is valid for all of them. If I swap the order of the IF statements below, they all work. If the $ratesSQL
is first then both 1) and 2) work. If either of the other two are first, then only 1) works.
The SQL:
$sqlRates = "
LOAD XML LOCAL INFILE '/xx/yy/zz/example.xml'
REPLACE
INTO TABLE rates
ROWS IDENTIFIED BY '<row>'";
Both $vixSQL
and $aaaSQL
are a lot of REPLACE INTO
statements. Example:
REPLACE INTO aaa (date,value) VALUES ('2016-01-29','4.05'); REPLACE INTO aaa (date,value) VALUES ('2016-01-28','4.07');
The IF statements:
1) Successful submission with the below. $ratesSQL is approximately 300 rows of data.
if (mysqli_multi_query($dbc, $ratesSQL)) {
echo "<h3>Rates Load Successful</h3><br>";
} else {
echo "<h3>Rates Load Error</h3><br>";
}
2) Successful submission. ~8000 rows of data.
if (mysqli_multi_query($dbc, $vixSQL)) {
echo "<h3>VIX Load Successful</h3><br>";
} else {
echo "<h3>VIX Load Error</h3><br>";
}
3) Failed Submission, ~8000 rows of data
if (mysqli_multi_query($dbc, $aaaSQL)) {
echo "<h3>AAA Load Successful</h3><br>";
} else {
echo "<h3>AAA Load Error</h3><br>";
}
The $ratesSQL
submission is only about 300 rows of data whilst the other two are about 8000. Is it this data quantity that is causing me issues? Any suggestions for getting round it?
COMBINING QUERIES PER ANSWER BELOW ALLOWS ME TO GET AROUND THIS. STILL PUZZLING AS TO WHY SEPARATE QUERIES FAILED. ANY FURTHER INFO WOULD BE APPRECIATED