我在另一个查询中添加的多个查询无法运行。内部查询中的存储过程未执行。单独的多查询运行良好,但在循环内却没有。冷,请检查,为什么InnerQuery不在循环内执行?
<?php
include ("../mysqli.php");
if (mysqli_connect_errno()) {
printf("Connection error: %s\n", mysqli_connect_error());
exit();
}
# Check Start Time
$time1 = microtime(true);
## Start
if ($DBquery = $mysqli->query("SELECT `id` FROM `Universe`")) {
while($obj = $DBquery->fetch_object()){
$id = $obj->id;
echo "Start with Product-ID: " . $id . "<br>";
# Defining Inner Query
$DBInnerQuery = "
SET @CATEGORY := (SELECT ....);
SET @Date := (SELECT ...
CALL `PROCEDURE1`;
SET @COUNTRY := (SELECT ....);
CALL `PROCEDURE2`;
...
";
# Inner Query does not run and I don't know why:
if ($mysqli->multi_query($DBInnerQuery)) {
$time2 = microtime(true) - $time1;
echo "Scan for Product-Id " . $id . " solved in "
. round ($time2, 4) . " seconds<br>";
}
}
}
echo "End of Product Check." . "<br>";
?>
答案 0 :(得分:0)
与此同时,我已经解决了这个问题:
# Defining Inner Query
CALL `PROCEDURE1;`;
# Multi Query
if ($mysqli->multi_query($DBInnerQuery)) {
echo "<hr>" . "Scan for all Items solved." . "<br>";
}
$time2 = microtime(true) - $time;
echo "Used Time: "
. round ($time, 4) . " Seconds<br>";
echo "End." . "<br>";