【发布时间】:2012-09-05 18:38:47
【问题描述】:
这是我正在尝试的:
if($mysqli->multi_query(file_get_contents('file_that_contains_a_bunch_of.sql'))) {
do {
$result = $mysqli->use_result();
if($mysqli->errno === 0) {
echo $mysqli->affected_rows.' row(s) affected'.PHP_EOL;
} else {
die($mysqli->error);
}
} while($mysqli->next_result());
}
但它会提前中止循环并且不会打印错误消息。如何找出错误是什么?
【问题讨论】:
-
您应该在
die()调用中收到错误消息。 -
@MikeBrant:没有达到这个目标——这就是问题所在。
-
为什么不使用 mysql 的 exec 转储?
-
@JvdBerg:这是一个更大脚本的一部分。