這裏就是我想:如何使用mysqli :: multi_query獲取錯誤消息?
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());
}
但它早中止循環,不打印錯誤消息。我如何知道錯誤是什麼?
你應該在你'模具()'調用會得到錯誤信息。 –
@MikeBrant:這不是那個 - 那就是問題所在。 – mpen
爲什麼不從exec使用mysql轉儲? – JvdBerg