drydaenth257216154 2016-06-10 13:33
浏览 31
已采纳

循环内的脚本标准[重复]

Below I have some code and an error. So first I'll explain what my code does. During the install process of my script one of the things it does is it pulls the SQL files and runs them through and into the database before writing the configuration file. The code below works, but it gives the Strict Standards Error multiple times which then breaks my result from creating the configuration file and in turn the js scripts are broken since they just give the errors. I'm not sure how to go about fixing this with my current script and have and figured someone may look at this and realize that it's something they've seen before and it's actually an easy fix.

Strict Standards: mysqli::next_result(): There is no next result set. Please, call 
mysqli_more_results()/mysqli::more_results() 

Code:

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);
    }
</div>
  • 写回答

1条回答 默认 最新

  • dongzhong5756 2016-06-10 13:47
    关注

    Did you try what the error message is telling you?

    Something like:

    while ($link->more_results()) {
        $link->next_result();
    }
    

    Or you can try:

    while ($link->more_results() && $link->next_result()) {
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 keil的map文件中Image component sizes各项意思
  • ¥30 BC260Y用MQTT向阿里云发布主题消息一直错误
  • ¥20 求个正点原子stm32f407开发版的贪吃蛇游戏
  • ¥15 划分vlan后,链路不通了?
  • ¥20 求各位懂行的人,注册表能不能看到usb使用得具体信息,干了什么,传输了什么数据
  • ¥15 Vue3 大型图片数据拖动排序
  • ¥15 Centos / PETGEM
  • ¥15 划分vlan后不通了
  • ¥20 用雷电模拟器安装百达屋apk一直闪退
  • ¥15 算能科技20240506咨询(拒绝大模型回答)