【发布时间】:2016-06-10 13:33:42
【问题描述】:
下面我有一些代码和一个错误。所以首先我将解释我的代码是做什么的。在我的脚本的安装过程中,它所做的一件事就是在编写配置文件之前提取 SQL 文件并将它们运行并进入数据库。下面的代码有效,但它多次给出严格标准错误,然后破坏了我创建配置文件的结果,反过来 js 脚本也被破坏了,因为它们只是给出了错误。我不知道如何用我当前的脚本解决这个问题,并且我认为有人可能会看到这个并意识到这是他们以前见过的东西,而且实际上很容易解决。
Strict Standards: mysqli::next_result(): There is no next result set. Please, call
mysqli_more_results()/mysqli::more_results()
代码:
function TestConnection($host, $user, $pass, $data) {
$link = mysqli_connect($host, $user, $pass, $data);
if (!$link) {
echo "Error: Unable to connect to MySQL." . PHP_EOL;
echo "Debugging errno: " . mysqli_connect_errno() . PHP_EOL;
echo "Debugging error: " . mysqli_connect_error() . PHP_EOL;
exit;
}
foreach(glob(root_p."/install/SQL/create/*.sql") as $sqlfile) {
$command = file_get_contents($sqlfile);
$link->multi_query($command);
while ($link->next_result()) {
;
} //flush
$link->query($command);
}
CreateConfig($host, $user, $pass, $data);
mysqli_close($link);
}
【问题讨论】: