我有困难打电话并显示内容时,我调用过程中不止一次的页面。 我想从两个不同的SP呼吁MYSQL显示两个单独的记录集。 我可以显示第一个呼叫,但第二个失败。 我不知道我在做什么错,但也许有人能帮助样?
我不断收到当我打电话第二个过程的错误:
Error calling SPCommands out of sync; you can't run this command now
我在Windows上运行
下面的代码... PHP
// First call to SP
$page = 2;
$section = 1;
include("DatabaseConnection.php"); //general connection - works fine
$sql = 'CALL GetPageContent("'.$page.'", "'.$section.'")';
$result = mysqli_query($conn, $sql) or die('Error calling SP' .mysqli_error($conn));
while($row=mysqli_fetch_assoc($result))
{
// DO STUFF< REMOVED TO MAKE READING CLEARER
}
mysqli_free_result($result);
//SECOND CALL BELOW
$section = 2; // change parameter for different results
$sql = 'CALL GetPageContent("'.$page.'", "'.$section.'")';
$result = mysqli_query($conn, $sql) or die('Error calling SP' .mysqli_error($conn));
while($row=mysql_fetch_assoc($result))
{
// DO STUFF< REMOVED TO MAKE READING CLEARER
}