real_query("call sp_test()")){       &"/> real_query("call sp_test()")){       &">

Home  >  Article  >  Backend Development  >  为啥php调用存储过程返回多个结果集,总要多出一个结果集

为啥php调用存储过程返回多个结果集,总要多出一个结果集

WBOY
WBOYOriginal
2016-06-13 12:44:02842browse

为什么php调用存储过程返回多个结果集,总要多出一个结果集
比如
$db->query("SET NAMES UTF8");   
if($db->real_query("call sp_test()")){   
    do{   
        echo 'bp';
        if($result = $db->store_result()){   
            while ($row = $result->fetch_assoc()){   
                array_push($rows, $row);   
            }   
            $result->close();   
        }   
    }while($db->next_result());   
}   
$db->close(); 

你会发现假设你返回1个结果集,会打出2个bp,2个结果集就会echo出3个bp,但如果不写存储,直接写语句,就正常,不会多出一个,求大神指点迷津!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn