English 中文(简体)
运行多个 MMSQL 存储程序时调用 SPCommand 出错
原标题:Error calling SPCommands when running multiple MYSQL Stored Procedures
  • 时间:2012-05-24 19:59:42
  •  标签:
  • php
  • mysql

我是新来的 php 但不是作为一个程序员。 。 。

当我在一页中多次调用一个程序时,我很难调用和显示内容。我试图显示两种不同的SP调用MISQL的两套单独记录。我可以显示第一个调用,但第二个调用失败。我不知道我做错了什么,但也许有人能帮上忙吗?

我不断得到错误 当我打电话 第二个程序:

调用 SPCommands 出同步时出错错误; 您现在无法运行此命令

我在窗口上运行btw

下面的代码... 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
}


mysqli_free_result($result);
问题回答

问题是你的SP给了你多重结果

使用 Mysqli_multi_query, 见< a href="https://www.php.net/mysqli_multi_query" rel=“ 不跟随 no follown norefererr" >https://www.php.net/mysqli_multi_query





相关问题
SQL SubQuery getting particular column

I noticed that there were some threads with similar questions, and I did look through them but did not really get a convincing answer. Here s my question: The subquery below returns a Table with 3 ...

please can anyone check this while loop and if condition

<?php $con=mysql_connect("localhost","mts","mts"); if(!con) { die( unable to connect . mysql_error()); } mysql_select_db("mts",$con); /* date_default_timezone_set ("Asia/Calcutta"); $date = ...

php return a specific row from query

Is it possible in php to return a specific row of data from a mysql query? None of the fetch statements that I ve found return a 2 dimensional array to access specific rows. I want to be able to ...

Character Encodings in PHP and MySQL

Our website was developed with a meta tag set to... <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> This works fine for M-dashes and special quotes, etc. However, I ...

Pagination Strategies for Complex (slow) Datasets

What are some of the strategies being used for pagination of data sets that involve complex queries? count(*) takes ~1.5 sec so we don t want to hit the DB for every page view. Currently there are ~...

Averaging a total in mySQL

My table looks like person_id | car_id | miles ------------------------------ 1 | 1 | 100 1 | 2 | 200 2 | 3 | 1000 2 | 4 | 500 I need to ...

热门标签